My code looks like
import numpy as np
from numpy import genfromtxt
train = genfromtxt('/Users/hhimanshu/Downloads/dataset/digitrecognizer/train.csv',
delimiter=',', names=True)
and the train.csv has data like
label,pixel0,pixel1,pixel2,pixel3, .....
1,0,0,0, ...
when I do
train.names
I get
---------------------------------------------------------------------------
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'
Also the shape seem incorrect to me
shape(Tuple of array dimensions) = (42000,)
dimension(Number of array dimensions) = 1
size(Number of elements in array) = 42000
I know that I have 785 columns and 2 dimensions(it says 1 here)
What is that I am not doing right?
My Bad,
ndarrayhas no attribute callednamesI can refer columns as
train['labels']and get the data