0

I have imported csv into present pgm and I got that csv from other pgm which I included into current pgm.After running it I got the below error:

GoogleData_X = google_data.Date[:, np.newaxis, 2]
AttributeError: 'str' object has no attribute 'Date'

where GoogleData_X is a variable and google_data in google_data.date is csv file which I imported and csv file has the following as attributes:

Date,Open,High,Low,Close,Volume
Vasilis G.
  • 7,556
  • 4
  • 19
  • 29
  • The error is clear. You variable `google_data` is a `string`. You can't do `.Date` on it because `str objects have no attribute 'Date'`. I don't know how you imported your `csv` file, but you probably read all lines of it as string, where I believe you were supposed to have a `data frame`. Try to read your `csv` using `google_data = pandas.read_csv('filename.csv')` instead – rafaelc Jul 01 '18 at 11:51
  • By using Pandas now i am getting error as:in _get_values return self._values[indexer] IndexError: too many indices for array – Meena Chowdary Jul 01 '18 at 12:04
  • Thats good. Now you have your `google_data` variable correct and your problem is in the second part of your statement. Try reading https://stackoverflow.com/questions/28036812/indexerror-too-many-indices-for-array as this error is common and has already been answered a couple of times ;) – rafaelc Jul 01 '18 at 12:07
  • Please provide more code. How did you get google_data? @RafaelC Answering unclear questions is in comments is bad practice, you could encourage OP to edit the question, then answer it. – Braca Jul 01 '18 at 12:10
  • I got google data by downloading quandl datasets using my API key – Meena Chowdary Jul 01 '18 at 12:18
  • Thanks for the advice @Braca but I just felt I had enough information to answer (just exactly the way I did). Should you need for info, just ask :) – rafaelc Jul 01 '18 at 12:18
  • @RafaelC Sorry, I don't understand why do you answer in comment instead of answer. Is the question answered? – Braca Jul 01 '18 at 13:54
  • @Braca Some questions are duplicated and not reproducible errors. This seems to be both :) So they should be left unanswered and be closed (but nothing stops you from helping OP anyway) – rafaelc Jul 01 '18 at 14:18

0 Answers0