Numpy equivalent of MATLAB's cell array

前端 未结 1 1052
攒了一身酷
攒了一身酷 2020-12-10 12:13

I want to create a MATLAB-like cell array in Numpy. How can I accomplish this?

相关标签:
1条回答
  • 2020-12-10 13:02

    Matlab cell arrays are most similar to Python lists, since they can hold any object - but scipy.io.loadmat imports them as numpy object arrays - which is an array with dtype=object.

    To be honest though you are just as well off using Python lists - if you are holding general objects you will loose almost all of the advantages of numpy arrays (which are designed to hold a sequence of values which each take the same amount of memory).

    0 讨论(0)
提交回复
热议问题