「Python」Numpy equivalent of MATLAB's cell array

Posted Thorough Repeater

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了「Python」Numpy equivalent of MATLAB's cell array相关的知识,希望对你有一定的参考价值。

转自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 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).

以上是关于「Python」Numpy equivalent of MATLAB's cell array的主要内容,如果未能解决你的问题,请参考以下文章

python Python setInterval来自http://stackoverflow.com/questions/2697039/python-equivalent-of-setinterv

text 来自https://stackoverflow.com/questions/7943751/what-is-the-python-3-equivalent-of-python-m-simpl

Base包equivalent

LeetCode 951. Flip Equivalent Binary Trees

使用不同大小的 h5py 数组保存

Proving Equivalences