当前位置: 移动技术网 > IT编程>脚本编程>Python > 「Python」Numpy equivalent of MATLAB's cell array

「Python」Numpy equivalent of MATLAB's cell array

2018年09月16日  | 移动技术网IT编程  | 我要评论

加拉雷斯,晚秋 快播,王雨薇 宋蔚佳

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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网