First, I saved a NumPy array by the following command:
filename = 'D:\Data\\my_folder\\mydata.npy'
with open(filename, 'wb') as file:
np.save(filename, numpy_array, allow_pickle=True, fix_imports=True)
The file is saved in the correct location.
Then, I tried to read it by
filename = 'D:\Data\\my_folder\\mydata.npy'
with open(filename, 'rb') as file:
numpy_array = np.load(filename, allow_pickle=True, fix_imports=True)
However, it raised the following error:
UnpicklingError: Failed to interpret file 'D:\\Data\\my_folder\\mydata.npy' as a pickle
I was wondering if somebody could help me to fix this issue.