Python Forum

Full Version: hi guys, I got data reader error while pulling the data from yahoo
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This error which I got, I am using python 3
[Image: error.jpg]

Thanks in advance!! Smile
It's wrong import for DataReader.
Try to use code tag and not image.
>>> import pandas_datareader.data as web
>>>
>>> web.DataReader('PG', data_source='yahoo', start='2015-1-1')
                  High         Low        Open       Close     Volume   Adj Close
Date
2015-01-02   91.000000   89.919998   90.839996   90.440002  7251400.0   76.282951
2015-01-05   91.000000   89.849998   90.230003   90.010002  8626100.0   75.920288
2015-01-06   90.559998   89.260002   90.309998   89.599998  7791200.0   75.574463
2015-01-07   90.370003   89.559998   89.940002   90.070000  5986600.0   75.970879
2015-01-08   91.230003   90.129997   90.480003   91.099998  6823300.0   76.839638
...                ...         ...         ...         ...        ...         ...
2020-05-08  116.300003  113.389999  113.519997  115.949997  9283100.0  115.949997
2020-05-11  116.010002  114.919998  115.750000  115.309998  6946300.0  115.309998
2020-05-12  115.900002  114.139999  115.199997  114.550003  6734400.0  114.550003
2020-05-13  115.349998  113.730003  114.279999  113.919998  9312600.0  113.919998
2020-05-14  114.449997  111.250000  113.540001  113.809998  9310000.0  113.809998

[1351 rows x 6 columns]
Or could just use data and now wb,in your import.
>>> from pandas_datareader import data, wb
>>>
>>> data.DataReader('PG', data_source='yahoo', start='2015-1-1')
                  High         Low        Open       Close     Volume   Adj Close
Date
2015-01-02   91.000000   89.919998   90.839996   90.440002  7251400.0   76.279633
2015-01-05   91.000000   89.849998   90.230003   90.010002  8626100.0   75.916954
2015-01-06   90.559998   89.260002   90.309998   89.599998  7791200.0   75.571159
2015-01-07   90.370003   89.559998   89.940002   90.070000  5986600.0   75.967552
2015-01-08   91.230003   90.129997   90.480003   91.099998  6823300.0   76.836281
...                ...         ...         ...         ...        ...         ...
2020-05-08  116.300003  113.389999  113.519997  115.949997  9283100.0  115.949997
2020-05-11  116.010002  114.919998  115.750000  115.309998  6946300.0  115.309998
2020-05-12  115.900002  114.139999  115.199997  114.550003  6734400.0  114.550003
2020-05-13  115.349998  113.730003  114.279999  113.919998  9312600.0  113.919998
2020-05-14  114.449997  111.250000  113.540001  113.809998  9310000.0  113.809998

[1351 rows x 6 columns]