Skip to content

BUG: Fix Datareader dtypes if there are missing values from Google. #9025

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

Merged
merged 1 commit into from
Dec 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.15.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,4 @@ Bug Fixes


- Fixed ValueError raised by cummin/cummax when datetime64 Series contains NaT. (:issue:`8965`)
- Bug in Datareader returns object dtype if there are missing values (:issue:`8980`)
2 changes: 1 addition & 1 deletion pandas/io/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _retry_read_url(url, retry_count, pause, name):
pass
else:
rs = read_csv(StringIO(bytes_to_str(lines)), index_col=0,
parse_dates=True)[::-1]
parse_dates=True, na_values='-')[::-1]
# Yahoo! Finance sometimes does this awesome thing where they
# return 2 rows for the most recent business day
if len(rs) > 2 and rs.index[-1] == rs.index[-2]: # pragma: no cover
Expand Down
4 changes: 2 additions & 2 deletions pandas/io/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def test_get_multi2(self):
assert_n_failed_equals_n_null_columns(w, result)

def test_dtypes(self):
#GH3995
data = web.get_data_google('MSFT', 'JAN-01-12', 'JAN-31-12')
#GH3995, #GH8980
data = web.get_data_google('F', start='JAN-01-10', end='JAN-27-13')
assert np.issubdtype(data.Open.dtype, np.number)
assert np.issubdtype(data.Close.dtype, np.number)
assert np.issubdtype(data.Low.dtype, np.number)
Expand Down