printarr#

printarr(arr, fmt=None, colsep='  ', vsep='—', decimals=2, doprint=True, dtype=None)[source]#

Print a numpy array nicely.

Parameters:
  • arr (array) – the array to print

  • fmt (str) – the formatting string to use

  • colsep (str) – the separator between columns of values

  • vsep (str) – the vertical separator between 2D slices

  • decimals (int) – number of decimal places to print

  • doprint (bool) – whether to print (else, return the string)

Examples:

numeric = pl.randn(3,7,4)**10
mixed = np.array([['cat', 'nudibranch'], [23, 2423482]], dtype=object)
sc.printarr(numeric)
sc.printarr(mixed)

New in version 2.0.3: “fmt”, “colsep”, “vsep”, “decimals”, and “dtype” arguments New in version 3.0.0: “doprint” argument