我的代码看起来像
import numpy as np
from numpy import genfromtxt
train = genfromtxt('/Users/hhimanshu/Downloads/dataset/digitrecognizer/train.csv',
delimiter=',', names=True)
并且train.csv
有类似的数据
label,pixel0,pixel1,pixel2,pixel3, .....
1,0,0,0, ...
当我做
train.names
我明白了
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-62-dea84e8fe1f5> in <module>()
4 print 'size(Number of elements in array) = ', train.size
5 # print 'data type = ', train.dtype
----> 6 train.names
AttributeError: 'numpy.ndarray' object has no attribute 'names'
形状对我来说也不正确
shape(Tuple of array dimensions) = (42000,)
dimension(Number of array dimensions) = 1
size(Number of elements in array) = 42000
我知道我有785列和2 个维度(这里说 1)
我做错了什么?