我有一个数字表
<Table length=3>
a b
int64 int64
----- -----
1 3
2 5
4 7
而且我想将一行转换为numpy数组。但是,当我尝试时,最终得到的数组没有维度
In: np.array(mytable[0]).shape
Out: ()
如果可以的话
myrow = mytable[0]
myrow[0]
我收到错误
IndexError: too many indices for array
[我是否可以执行类似t[0].values
的操作,返回array([1, 3])
?
>>> np.lib.recfunctions.structured_to_unstructured(np.array(t[0]))
array([1, 3])
>>> np.lib.recfunctions.structured_to_unstructured(np.array(t[1:]))
array([[2, 5],
[4, 7]])
>>> np.array(list(t[0]))
array([1, 3])