-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

4
  • 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 2, 2017 at 8: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 2, 2017 at 8: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 2, 2017 at 8:53
  • I'm just a beginner, I just want to know how this code works. I got the references here link , and this is link the data I have
    – V.O Vian
    Oct 2, 2017 at 9:18

1 Answer 1

-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.

2
  • 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 Oct 2, 2017 at 8:52
  • Thanks for advice. I will answer better next time. Oct 2, 2017 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.