Rishikesh-12
Rishikesh-12

Reputation: 63

How to use GOOGLE as a data source for pandas data reader?

I wanted to get the data from google source but i am encountering some error

here is my code --

from pandas_datareader import data
import datetime
start=datetime.datetime(2020,1,1)
end=datetime.datetime(2020,6,30)
print(data.DataReader("TSLA",'google',start,end))

Error I am encountering:

NotImplementedError                       Traceback (most recent call last)
<ipython-input-25-a7c6d692c622> in <module>
      1 start=datetime.datetime(2020,1,1)
      2 end=datetime.datetime(2020,6,30)
----> 3 print(data.DataReader("TSLA",'google',start,end))

c:\users\rishi\appdata\local\programs\python\python38-32\lib\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs)
    212                 else:
    213                     kwargs[new_arg_name] = new_arg_value
--> 214             return func(*args, **kwargs)
    215 
    216         return cast(F, wrapper)

c:\users\rishi\appdata\local\programs\python\python38-32\lib\site-packages\pandas_datareader\data.py in DataReader(name, data_source, start, end, retry_count, pause, session, api_key)
    374     if data_source not in expected_source:
    375         msg = "data_source=%r is not implemented" % data_source
--> 376         raise NotImplementedError(msg)
    377 
    378     if data_source == "yahoo":

NotImplementedError: data_source='google' is not implemented

Upvotes: 4

Views: 12299

Answers (4)

Aman Jaiswal
Aman Jaiswal

Reputation: 1093

For Prevalent opinion on the network, Google have discontinued as data source. others source can be used like Yahoo...

Here is the reference for this:

import datetime
import yfinance as yf
yf.pdr_override()

# we have 2 ways
#---------------------1st by using DataReader ---------------------------

start = datetime.datetime(int(2006), int(1), 1)
end = datetime.datetime(int(2016), int(1), 1)

# Bank of America
BAC = data.DataReader("BAC", 'yahoo', start, end)

#----------------------2nd by using get_data_yahoo------------------------

start = datetime.datetime(2006, 1, 1)
end = datetime.datetime(2016, 1, 1)
# Bank of America
BAC = data.get_data_yahoo('BAC', start.date(), end.date())

Upvotes: 0

Ishaque3 Nizamani
Ishaque3 Nizamani

Reputation: 61

Write yahoo instead of google like:

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

Upvotes: 3

user12578371
user12578371

Reputation:

Make sure to use the data source as

data_source == "yahoo"

Upvotes: 0

Helen Craigman
Helen Craigman

Reputation: 1453

Prevalent opinion on the network is, that 'google' as data source has been discontinued.

Other sources, like yahoo and Alpha Vantage, do function.

Upvotes: 5

Related Questions