Sometimes, I would like to print a numpy array just to copy it from the command line into somewhere else. The standard __repr__ is close, but missing the commas:
import numpy as np
a = np.random.rand(5, 2)
print(a)
[[0.66585668 0.5793219 ]
[0.28048686 0.11019737]
[0.41359919 0.69354774]
[0.02062253 0.85507001]
[0.05443759 0.51366551]]
Any hints?
print(a.tolist())print(repr(a))np.array2string?