zoukankan      html  css  js  c++  java
  • 「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).

    如非注明,原创内容遵循GFDLv1.3发布;其中的代码遵循GPLv3发布。
  • 相关阅读:
    jvm09
    jvm08
    jvm07
    求解最长公共子序列问题
    归并排序
    求解N皇后问题
    快速排序算法
    求解0/1背包问题
    求解全排列问题
    求解最大连续子序列和问题
  • 原文地址:https://www.cnblogs.com/samhx/p/9654817.html
Copyright © 2011-2022 走看看