0

I have a list of numpy arrays with different dimensions that I want to save. I can always save each numpy array in this list as an npz file. My problem is that beforehand, I wouldn't know how many arrays there are in this list. If I try saving this list into an npz file and attempt to load this list, I get

Object arrays cannot be loaded when allow_pickle=False

What is a recommended way to save this list?

I'm coming from MATLAB wherein you can save cell arrays, structs, matrices into a single .mat file and I'm wondering what the equivalent would be here in python.

secondrate
  • 119
  • 4

1 Answers1

0

I am not sure of doing this in Numpy but in Pandas, by using HDF5 format you can store multiple files to the same file. You need to add different keys to the elements. Here is some example from a different question that use numpy and hdf5 Input and output numpy arrays to h5py

jaimebw
  • 25
  • 9