Skip to content

Commit 84b4c2d

Browse files
BUG: Fix Datareader dtypes if there are missing values from Google.
1 parent 7bd1b24 commit 84b4c2d

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

doc/source/whatsnew/v0.15.2.txt

+1
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,4 @@ Bug Fixes
222222

223223

224224
- Fixed ValueError raised by cummin/cummax when datetime64 Series contains NaT. (:issue:`8965`)
225+
- Bug in Datareader returns object dtype if there are missing values (:issue:`8980`)

pandas/io/data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def _retry_read_url(url, retry_count, pause, name):
166166
pass
167167
else:
168168
rs = read_csv(StringIO(bytes_to_str(lines)), index_col=0,
169-
parse_dates=True)[::-1]
169+
parse_dates=True, na_values='-')[::-1]
170170
# Yahoo! Finance sometimes does this awesome thing where they
171171
# return 2 rows for the most recent business day
172172
if len(rs) > 2 and rs.index[-1] == rs.index[-2]: # pragma: no cover

pandas/io/tests/test_data.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ def test_get_multi2(self):
118118
assert_n_failed_equals_n_null_columns(w, result)
119119

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

0 commit comments

Comments
 (0)