One way that helped me was to dump the numpy array loaded in python2. *, to the csv file, and then read it back into python3. *
# Dump in python2 import numpy as np datafile = matplotlib.cbook.get_sample_data('goog.npy', asfileobj=False) arr = np.load(datafile) np.savetxt("np_arr.csv", arr, delimiter=",")
Now read the file back in python3
# Load in python3 import numpy as np arr = np.loadtxt(open("np_arr.csv"), delimiter=",")
user1683894
source share