Skip to content
Advertisement

ValueError: Object arrays cannot be loaded when allow_pickle=False

I tried to get solution for this code , hoping for a positive response

 much_data = np.load('muchdata-50-50-20.npy')

output:

ValueError                                Traceback (most recent call last)
<ipython-input-6-6710fe7f2bb7> in <module>
----> 1 much_data = np.load('muchdata-50-50-20.npy')

~anaconda3envstf-gpu-cuda8libsite-packagesnumpylibnpyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding)
    437                 return format.open_memmap(file, mode=mmap_mode)
    438             else:
--> 439                 return format.read_array(fid, allow_pickle=allow_pickle,
    440                                          pickle_kwargs=pickle_kwargs)
    441         else:

~anaconda3envstf-gpu-cuda8libsite-packagesnumpylibformat.py in read_array(fp, allow_pickle, pickle_kwargs)
    725         # The array contained Python objects. We need to unpickle the data.
    726         if not allow_pickle:
--> 727             raise ValueError("Object arrays cannot be loaded when "
    728                              "allow_pickle=False")
    729         if pickle_kwargs is None:

ValueError: Object arrays cannot be loaded when allow_pickle=False

Please let me know the solution for this

Advertisement

Answer

Try

 much_data = np.load('muchdata-50-50-20.npy', allow_pickle=True)
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement