numpy.ndarray

来源:互联网 发布:数据可以储存什么文字 编辑:程序博客网 时间:2024/05/17 03:15


there is 2 same list in a list

3x1 and 3x1


f=np.array([[1,2,3],[10,11,12]])


f[a==0, 1]
Out[45]: array([2])


f.shape
Out[46]: (2L, 3L)


#####


there are 2 different list in a list

3x1 and 2x1


f=np.array([[1,2,3],[10.11,12]])


type(f)
Out[40]: numpy.ndarray


f.shape
Out[41]: (2L,)


f[a==0]
Out[42]: array([[1, 2, 3]], dtype=object)


f[a==0, 1]
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-43-07bceb2b55f4> in <module>()
----> 1 f[a==0, 1]


IndexError: too many indices for array

0 0
原创粉丝点击