「Python」Numpy equivalent of MATLAB's cell array
阿新 • • 發佈:2018-09-16
design ike can acc sta sig bject b- tlab s - 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).
轉自Stackoverflow。備忘用。
Question
I want to create a MATLAB-like cell array in Numpy. How can I accomplish this?
Answer
Matlab cell arrays are most similar to Python list
s, 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 list
「Python」Numpy equivalent of MATLAB's cell array