pydata / pandas-datareader

Extract data from a wide range of Internet sources into a pandas DataFrame.
https://pydata.github.io/pandas-datareader/stable/index.html
Other
2.92k stars 682 forks source link

ImmediateDeprecationError of Google Finance data #587

Closed koshtinikhilesh closed 5 years ago

koshtinikhilesh commented 6 years ago

Hello, I want to get the financial crisis data from 2006 to 2016 of Bank of America. So i used the following way:--

from pandas_datareader import data, wb BAC = data.DataReader("BAC", 'google', start, end)

It state error:-- ImmediateDeprecationError: Google finance has been immediately deprecated due to large breaks in the API without the introduction of a stable replacement. Pull Requests to re-enable these data connectors are welcome.

addisonlynch commented 6 years ago

Google Finance has discontinued their API, and as such this feature is deprecated (marked for removal) in Pandas Datareader. Alternatives to Google Finance include Alpha Vantage, Quandl, and IEX.

lfirpo commented 6 years ago

try this: df = web.DataReader( selected_dropdown_value, data_source='yahoo', start=dt(2017, 1, 1), end=dt.now())

change 'google' for 'yahoo'

harishb049 commented 6 years ago

Hi I tried using 'yahoo' instead of 'google', but it looks like the 'yahoo' api is deprecated as well. "Yahoo Daily has been immediately deprecated due to large breaks in the API without the introduction of a stable replacement. Pull Requests to re-enable these data connectors are welcome."

Any alternative solution to extract the data?

addisonlynch commented 6 years ago

@harishb049 please see my original comment. Alternatives include:

IEX

df = web.DataReader("BAC", "iex", start, end)

Quandl

df = web.DataReader("BAC", "quandl", start, end)
Valvandi commented 5 years ago

Can as well do:

BAC = data.DataReader("BAC", "iex", start, end)

Aleleonel commented 5 years ago

@Valvandi obrigado realmente seu comentário foi de grande ajuda...

adityathakur2310 commented 5 years ago

Google discontinued the API, use IEX instead, that lets you obtain the data for the past 5 years

mejihero commented 5 years ago

same issue

mujahid7292 commented 5 years ago

This solution work. BAC = data.DataReader("BAC", 'quandl', start, end,access_key="YOUR API KEY FROM QUANDL")

Amitmoin commented 5 years ago

guys , iam using below but data is not fetching PG = wb.DataReader('PG', 'quandl', start='2018-01-01', end='2018-01-31',access_key='')

mujahid7292 commented 5 years ago

guys , iam using below but data is not fetching PG = wb.DataReader('PG', 'quandl', start='2018-01-01', end='2018-01-31',access_key='')

PG = data.DataReader('PG', 'quandl', start='2018-01-01', end='2018-01-31',access_key='****')

Amitmoin commented 5 years ago

not working import numpy as np import pandas_datareader as pd from pandas_datareader import data as wb import matplotlib.pyplot as plt

PG = wb.DataReader('PG', 'quandl', start='2018-01-01', end='2018-01-01',access_key=' access key was put ')

not any data is fetching

mujahid7292 commented 5 years ago

not working import numpy as np import pandas_datareader as pd from pandas_datareader import data as wb import matplotlib.pyplot as plt

PG = wb.DataReader('PG', 'quandl', start='2018-01-01', end='2018-01-01',access_key=' access key was put ')

not any data is fetching

Your import is wrong. from pandas_datareader import data, wb

Amitmoin commented 5 years ago

well print command is miss it, now data is importing. but i need code how to import NSE 50 company data in one go.

www.nseindia.com NSE is index in consist of 50 top performing companies

vischia commented 5 years ago

Hello,

the IEX source works, but there are no adjusted values; I get the following columns:

whereas from quandl I was getting 12 columns:

Am I missing something, or are the adjusted prices simply not available from IEX? I have briefly looked here: https://pandas-datareader.readthedocs.io/en/latest/readers/iex.html but I could not quite understand if perhaps it's a matter of additional parameters to be set.

Thank you in advance!

chrismahn commented 5 years ago

import pandas_datareader as pdr import datetime

start = datetime.datetime(2006,1,1) ends = datetime.datetime(2017,1,1)

bac = pdr.get_data_yahoo('BAC',start,ends) print(bac.head())

vischia commented 5 years ago

It still gives only the adjusted close: "High Low Open Close Volume Adj Close" while still missing "Ex-Dividend, Split Ratio, Adj Open, Adj High, Adj Low, Adj Volume"

If it can be relevant, I am using the pandas-datareader shipped via pip3:

pdr.version '0.7.0'

mabusalah commented 5 years ago

The below should work: import datetime as dt from pandas_datareader import data stocks = data.DataReader(name="GOOG",data_source="yahoo", start=dt.date(2000, 1, 1), end=dt.datetime.now()) stocks.head(3)

Shayan-Asgari commented 5 years ago

Unfortunately, the data_source from 'google' does not work so we have to use the yahoo one for the time being as mabusalah has said.

addisonlynch commented 5 years ago

See my comment above:

Google Finance has discontinued their API, and as such this feature is deprecated (marked for removal) in Pandas Datareader. Alternatives to Google Finance include Alpha Vantage, Quandl, and IEX.

This is not an issue for pandas_datareader. Please close.

vischia commented 5 years ago

@Shayan-Asgari , @mabusalah , thank you for the code snippet, but it works exactly like mine, and it does not answer to my question :)

I am comparing the output of "yahoo" (that gives "High Low Open Close Volume Adj Close") to the one of quandl (that gives the same columns, PLUS the columns "Ex-Dividend, Split Ratio, Adj Open, Adj High, Adj Low, Adj Volume").

My question is how can I get those additional columns with the "yahoo" data source: the code you pasted works the same way as the one i posted above works, i.e. only partially (giving only the Close as adjusted quantity).

Is there a way of using the "yahoo" data source AND get the additional columns? If not, why? Can I just infer the adjustment factor from adj_close/close and apply it to the other columns? I am not familiar on whether the different adjusted quantities are adjusted (i.e. a common adjustment factor or different factors per-column).

Amitmoin commented 5 years ago

Please use belo code

import numpy as np import pandas as pd import matplotlib.pyplot as plt from pandas_datareader import data as WB PG=WB.DataReader('PG','quandl',start='2015-12-01',end='2018-12-31',acess_key='') print(PG)

Shayan-Asgari commented 5 years ago

Hello @vischia, I am not entirely, however, you can get the extra/other columns into a DataFrame and then use Pandas built in concatenate method with axis=1 to concatenate it with a final DataFrame to have all your desired values. Or better yet, if there are subtle discrepancies between the information of the two data source websites you can use the apply method which perhaps takes the mean of each of the values from each of the two website's data.

Hopefully this helps and sorry if it does not as I have just started to get into Data Science/Machine Learning.

Regards, Shayan Asgari

olubadmus commented 5 years ago

I obtained an API Key from Quandl, I dont know why this error keeprs popping up:

TypeError: init() got an unexpected keyword argument 'max_rows'

Can anyone help pls?

Amitmoin commented 5 years ago

Give full code

On Fri, Feb 1, 2019, 9:10 PM olubadmus <notifications@github.com wrote:

I obtained an API Key from Quandl, I dont know why this error keeprs popping up:

TypeError: init() got an unexpected keyword argument 'max_rows'

Can anyone help pls?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pydata/pandas-datareader/issues/587#issuecomment-459764367, or mute the thread https://github.com/notifications/unsubscribe-auth/AooKsjmqLoLPVU-5xYN0khGI52j06Dspks5vJGAKgaJpZM4XH6I4 .

olubadmus commented 5 years ago

BAC = wb.DataReader('BAC', 'quandl', access_key=' provided key ', start=2017, 1, 1, end=2018, 1, 12)

dberrian commented 5 years ago

"iex" can be used only for past of maximum 5 years from the actual moment. But "get_data_yahoo" can retrieve data for any period of time. For example: from pandas_datareader import data,wb import pandas as pd import datetime

srt = datetime.datetime(2006,1,1) end = datetime.datetime(2016,1,1) BAC = data.get_data_yahoo('BAC',start,end) BAC.head()

  Date            High           Low                         Open              Close              Volume              Adj Close                     

2006-01-03 47.180000 46.150002 46.919998 47.080002 16296700.0 36.332104 2006-01-04 47.240002 46.450001 47.000000 46.580002 17757900.0 35.946239 2006-01-05 46.830002 46.320000 46.580002 46.639999 14970700.0 35.992565 2006-01-06 46.910000 46.349998 46.799999 46.570000 12599800.0 35.938522 2006-01-09 46.970001 46.360001 46.720001 46.599998 15619400.0 35.961674

snehalsandy commented 5 years ago

i think this is the easy way to do this

from pandas_datareader import data, wb import datetime start=datetime.datetime(2006,1,1) end=datetime.datetime(2016,1,1) BAC=data.DataReader("BAC",'yahoo',start,end) BAC.head()

wesley-ruede commented 5 years ago

"iex" can be used only for past of maximum 5 years from the actual moment. But "get_data_yahoo" can retrieve data for any period of time. For example: from pandas_datareader import data,wb import pandas as pd import datetime

srt = datetime.datetime(2006,1,1) end = datetime.datetime(2016,1,1) BAC = data.get_data_yahoo('BAC',start,end) BAC.head()

  Date            High             Low                         Open              Close              Volume              Adj Close                     

2006-01-03 47.180000 46.150002 46.919998 47.080002 16296700.0 36.332104 2006-01-04 47.240002 46.450001 47.000000 46.580002 17757900.0 35.946239 2006-01-05 46.830002 46.320000 46.580002 46.639999 14970700.0 35.992565 2006-01-06 46.910000 46.349998 46.799999 46.570000 12599800.0 35.938522 2006-01-09 46.970001 46.360001 46.720001 46.599998 15619400.0 35.961674

You are right on the money. IDX does returns forbidden and qunadl requires an API key. Yahoo has open data. Are there other data sources available besides Yahoo that work?

IEX as a source returns this error even within the constrains of 5 years:

RemoteDataError: Unable to read URL: https://api.iextrading.com/1.0/stock/market/batch?symbols=GOOGL&types=chart&range=5y Response Text: b'Forbidden'

gliptak commented 5 years ago

This was documented at https://github.com/pydata/pandas-datareader/blob/master/docs/source/whatsnew/v0.7.0.txt#L13

bashtage commented 5 years ago

Closing as answered

IchoCai commented 4 years ago

import pandas_datareader as pdr import datetime

start = datetime.datetime(2006,1,1) ends = datetime.datetime(2017,1,1)

bac = pdr.get_data_yahoo('BAC',start,ends) print(bac.head())

it works.

Rohit98671 commented 4 years ago

from pandas.datareader import data from datetime import datetime

start = datetime(yyyy, mm, dd) end = datetime(yyyy, mm, dd)

BAC = data.DataReader("BAC",'yahoo',start, end) BAC.head()

or if you are trying to get data from different banks using their ticker symbol then you can also do it as:

df = data.DataReader(["BAC", "C", "MS"], "yahoo",start, end)