-1

I have data (100 data in 1 row)

enter image description here

This is my code:

from pylearn2.datasets.csv_dataset import CSVDataset
import pickle

print ('convert: data.csv -> train.pkl')
pyln_data = CSVDataset("data.csv", one_hot=True, delimiter=',')
pickle.dump( pyln_data, open( "train.pkl" , 'w' ) )

but I get this error:

y = data[:, 0:self.num_outputs]
IndexError: too many indices for array

waka
  • 3,362
  • 9
  • 35
  • 54
V.O Vian
  • 53
  • 1
  • 10
  • 1
    The code you posted doesn't reproduce this error, besides the error is pretty self-explanatory, check the `shape` of your data. e.g. what does `y.shape` return? and what is the value of `self.num_outputs`? – EdChum Oct 02 '17 at 08:13
  • I confused, I just want convert data csv to pkl. I thought y.shape is not return, because 1D. The value of self.num_outputs =100 – V.O Vian Oct 02 '17 at 08:51
  • You've not posted any data or complete code in order for others to reproduce this error or the full traceback. As it stands this question becomes a fishing expedition – EdChum Oct 02 '17 at 08:53
  • I'm just a beginner, I just want to know how this code works. I got the references here [link](https://gist.github.com/k501/e0ab73e760504b99e7cc) , and this is [link](https://docs.google.com/spreadsheets/d/1cWiiNvtX-o51ekTgd3Wpk_3P9uRT8V0GgCAIebb39gA/edit#gid=0) the data I have – V.O Vian Oct 02 '17 at 09:18

1 Answers1

-1

Try y = data[: 0:self.num_outputs] without comma. Without more info it difficult to say more. In also you can use this decision.

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/17502523) – Toby Speight Oct 02 '17 at 08:52
  • Thanks for advice. I will answer better next time. – Yahor Tsyplakou Oct 02 '17 at 09:52