Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pandas_webreader can not be used #173

Closed
timinGo opened this issue Jul 24, 2017 · 12 comments
Closed

pandas_webreader can not be used #173

timinGo opened this issue Jul 24, 2017 · 12 comments

Comments

@timinGo
Copy link

timinGo commented Jul 24, 2017

I am trying to follow the experiements to study alphalens.
The problem is

import pandas_datareader.data as web
pan = web.DataReader(list(ticker_sector.keys()), "yahoo", '2014-12-01')

and

import pandas_datareader.data as web
pan = web.DataReader(list(ticker_sector.keys()), "google", '2014-12-01')

always can not be used,
is that possible to given a data file directly?

Thanks a lot!

@femtotrader
Copy link

femtotrader commented Jul 24, 2017

DataReader is removed in Pandas since Pandas 0.19 (and is deprecated since Pandas 0.17)
see https://github.com/pandas-dev/pandas/blob/master/pandas/io/data.py
http://pandas.pydata.org/pandas-docs/stable/whatsnew.html#whatsnew-0190-prior-deprecations
http://pandas.pydata.org/pandas-docs/stable/whatsnew.html#v0-17-0-october-9-2015

this is a standalone project available at https://github.com/pydata/pandas-datareader

You might install latest version from source (not from pip)

@twiecki
Copy link
Contributor

twiecki commented Jul 24, 2017

@femtotrader I think that's what he's already using.

@timinGo What's the error? You should be able to just feed in your own data.

@timinGo
Copy link
Author

timinGo commented Jul 24, 2017

@twiecki
@femtotrader
yep, I am trying to fellow the instruction as:

import pandas_datareader.data as web
pan = web.DataReader(list(ticker_sector.keys()), "google", '2014-12-01')

As I am trying to understand and modify some parts of codes, it is might be useful for me to get views from data structure.
Wow, now the problem is I can not use the example data, is that possible someone can give some data exactly equal to the data given in code_example.

@MichaelJMath
Copy link
Contributor

@timinGo , Are you transposing the panel after reading the data from Google?

import pandas_datareader.data as web
pan = web.DataReader(ticker_sector.keys(), "yahoo", '2014-12-01')
pan = pan.transpose(2,1,0)

@femtotrader
Copy link

My mistake! @twiecki I shouldn't send email during holidays before going to "playa".

But my advice to use latest development version still apply until 0.5.0 is not released see pydata/pandas-datareader#371

About Panel, be aware of depreciation see http://pandas-docs.github.io/pandas-docs-travis/whatsnew.html#whatsnew-0200-api-breaking-deprecate-panel and pydata/pandas-datareader#297

@timinGo
Copy link
Author

timinGo commented Jul 25, 2017

@femtotrader
@MichaelJMath

I am pretty sure this trouble is absolutely not about panel and which version problem.
The panel is not able to download from yahoo or google(ps: google has been blocked in China), and yahoo seems not work.
Is that fine to give a data file in the example folder, such as open_price.csv?

@MichaelJMath
Copy link
Contributor

MichaelJMath commented Jul 25, 2017

@timinGo, the yahoo finance API was discontinued by Yahoo. I meant to put "google" in the code snippet above. The Google API should work although I noticed there are some bad data points. That said, it should work fine for the alphalens example.

import pandas_datareader.data as web
pan = web.DataReader(['AAPL', 'GOOGL'], "google", '2014-12-01')
pan = pan.transpose(2,1,0)
pan.loc[:,:,'Open'].head()

This code outputs:

              AAPL   GOOGL
Date                      
2014-12-01  118.81  545.09
2014-12-02  113.50  539.45
2014-12-03  115.75  537.50
2014-12-04  115.77  537.64
2014-12-05  115.99  536.70

@timinGo
Copy link
Author

timinGo commented Jul 25, 2017

@MichaelJMath
Really thanks your kindly reply.
Ehh, my apologize with this problem is that Google has been banned by China gov....
So that is not easy for me to get data from google

@MichaelJMath
Copy link
Contributor

My apologies. I didn't catch on that you are in China. Are you able to access Quandl by any chance?

@timinGo
Copy link
Author

timinGo commented Jul 25, 2017

@MichaelJMath I think it might be works, just now checked web browser directly access fine.

@luca-s
Copy link
Collaborator

luca-s commented Jul 25, 2017

I understand from here and here that yahoo "API endpoint has changed and a patch has been made but hasn't been merged to the master branch of pandas-datareader yet".

So it should be just a temporarily issue. If you can use google, then use google in the meanwhile, otherwise there are proposed workarounds in the links above.

I am closing this issue soon, because this is not Alphalens related. Feel free to re-open it if you find Alphalens related issues.

@luca-s luca-s closed this as completed Jul 25, 2017
@timinGo
Copy link
Author

timinGo commented Jul 25, 2017

@luca-s luca-s
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants