-
Notifications
You must be signed in to change notification settings - Fork 679
Exception downloading yahoo historical data with adjust_price=True on fix-yahoo branch #342
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
Comments
created a pull request get a message about conflicts that must be resolved, probably the branch has been modified, can recreate this one for another branch if needed as merge for some reason was for the master not fix-yahoo |
Add 'null' in lower case to na_values defaults in pandas.read_csv #16471 |
Another solution will be to add 'null' in lower case to na_values defaults in pandas.read_csv but in any case this solution should not have any performance or other issues |
pandas-dev/pandas#16471 is scheduled for 0.21.0, Next Major Release.
even if you don't need price adjustment it is still a good idea to remove 'null' |
this still looks like an issue after #355
need a @OlegShteynbuk want to do a PR? |
will do it |
PR #357 |
Exception downloading yahoo historical data with adjust_price=True on fix-yahoo branch
This can be recreated for symbol = 'SRCE' and date range should include Jun 29, 2016
yahooData = pdr.data.get_data_yahoo(symbol, self.start, self.end, adjust_price=True)
File "/home/oleg/projects/openSource/python/pandas-datareader/yahoofix/pandas-datareader/pandas_datareader/data.py", line 40, in get_data_yahoo
return YahooDailyReader(*args, **kwargs).read()
File "/home/oleg/projects/openSource/python/pandas-datareader/yahoofix/pandas-datareader/pandas_datareader/yahoo/daily.py", line 117, in read
df = _adjust_prices(df)
File "/home/oleg/projects/openSource/python/pandas-datareader/yahoofix/pandas-datareader/pandas_datareader/yahoo/daily.py", line 170, in _adjust_prices
adj_ratio = hist_data['Adj Close'] / hist_data['Close']
File "/home/oleg/programs/python/anaconda2/envs/yahoofix/lib/python2.7/site-packages/pandas/core/ops.py", line 721, in wrapper
result = wrap_results(safe_na_op(lvalues, rvalues))
File "/home/oleg/programs/python/anaconda2/envs/yahoofix/lib/python2.7/site-packages/pandas/core/ops.py", line 692, in safe_na_op
lambda x: op(x, rvalues))
File "pandas/_libs/algos_common_helper.pxi", line 1212, in pandas._libs.algos.arrmap_object (pandas/_libs/algos.c:31954)
File "/home/oleg/programs/python/anaconda2/envs/yahoofix/lib/python2.7/site-packages/pandas/core/ops.py", line 692, in
lambda x: op(x, rvalues))
TypeError: unsupported operand type(s) for /: 'str' and 'str'
Environment:
followed the instruction found on one of the forums probably on stackoverflow:
git clone https://github.com/rgkimball/pandas-datareader
$ cd pandas-datareader
$ git checkout fix-yahoo
$ pip install -e .
It turned out that on yahoo web site the data displayed:
Jun 30, 2016 31.73 32.44 31.65 32.39 32.39 28,600
Jun 29, 2016 0.00 0.00 0.00 0.00 0.00 -
Jun 28, 2016 31.10 31.16 30.63 31.05 31.05 49,800
but when you click on the download button you will get:
2016-06-28 31.1 31.16 30.629999 31.049999 31.049999 49800
2016-06-29 null null null null null null
2016-06-30 31.73 32.439999 31.65 32.389999 32.389999 28600
string 'null' instead of 0.00 or '-'
The same lower case 'null' values will be if you use adjust_price=False in pdr.data.get_data_yahoo
The solution is to add 'null' in lower case to na_values argument to read_csv in function _read_lines in base.py
na_values=('-', 'null')
I have made this change that is my repository.
The text was updated successfully, but these errors were encountered: