Reputation: 89
hallo sorry for my bad English, I want to convert my pixels column to separated numpy array for every row (if read using pandas dataframe it columns values will be read as array). this is example of my dataset, I have tried split every row of pixels for every space, but because of the dataset is about 35.000 data and the pixels value are long, so the pandas going error
target, pixels
0, 12 14 14 16 29 30 29 39 50 60 12 10 0 29 40 14
1, 13 15 15 17 25 32 23 31 59 62 17 19 1 22 20 20
2, 12 16 16 18 32 33 22 45 23 12 12 10 2 50 45 13
to (if read by dataframe)
target, pixels
0, array[12,14,14,16,29,29,39,50,60,12,10,0,29,40,14]
1, array[13,15,15,17,25,32,23,31,59,62,17,19,1,22,20,20]
2, array[12,16,16,18,32,33,22,45,23,12,12,10,2,50,45,13]
Upvotes: 0
Views: 577
Reputation: 912
There maybe other methods that is more memory efficient, but I came up with a simple solution like this:
l = [] # this will be a storage list for your array
for n, row in enumerate(df.index):
df.iloc[row, :] = l[n]
Then you can access the separated array in the list l
Upvotes: 1
Reputation: 172
Not very much clear on your question, but hope below suggestion will help,
Try to convert the column in matrix --load it into a numpy array and reshape it so that it is in desired dimensional
I think for image pixle data, Digit Recognizer problem on MNIST data is very helpful Give a look to kaggle kernal
[https://www.kaggle.com/aman9d/digit-recognizer-svm-88-3-data-visualization/data][1]
Upvotes: 1