Skip to content

Commit e8716df

Browse files
committed
BUG: DataReader with yahoo-action raises TypeError
1 parent 0e22ac1 commit e8716df

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

pandas_datareader/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def DataReader(name, data_source=None, start=None, end=None,
8989
retry_count=retry_count, pause=pause,
9090
session=session).read()
9191
elif data_source == "yahoo-actions":
92-
return YahooActionReader(symbol=name, start=start, end=end,
92+
return YahooActionReader(symbols=name, start=start, end=end,
9393
retry_count=retry_count, pause=pause,
9494
session=session).read()
9595
elif data_source == "google":

pandas_datareader/tests/test_data.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,22 @@ def test_yahoo_reader_class(self):
319319
r = YahooDailyReader('GOOG', session=session)
320320
self.assertTrue(r.session is session)
321321

322+
def test_yahoo_DataReader(self):
323+
start = datetime(2010, 1, 1)
324+
end = datetime(2015, 5, 9)
325+
result = web.DataReader('AAPL', 'yahoo-actions', start, end)
326+
327+
exp_idx = pd.DatetimeIndex(['2015-05-07', '2015-02-05', '2014-11-06', '2014-08-07',
328+
'2014-06-09', '2014-05-08', '2014-02-06', '2013-11-06',
329+
'2013-08-08', '2013-05-09', '2013-02-07', '2012-11-07',
330+
'2012-08-09'])
331+
exp = pd.DataFrame({'action': ['DIVIDEND', 'DIVIDEND', 'DIVIDEND', 'DIVIDEND',
332+
'SPLIT', 'DIVIDEND', 'DIVIDEND', 'DIVIDEND',
333+
'DIVIDEND', 'DIVIDEND', 'DIVIDEND', 'DIVIDEND', 'DIVIDEND'],
334+
'value': [ 0.52, 0.47, 0.47, 0.47, 0.14285714, 0.47, 0.43571, 0.43571,
335+
0.43571, 0.43571, 0.37857, 0.37857, 0.37857]}, index=exp_idx)
336+
tm.assert_frame_equal(result, exp)
337+
322338

323339
class TestYahooOptions(tm.TestCase):
324340
@classmethod

0 commit comments

Comments
 (0)