Skip to content

Commit ac49e27

Browse files
committed
add test cases for fixing splitratio divided by zero error
1 parent 3099248 commit ac49e27

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pandas_datareader/tests/yahoo/test_yahoo.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,24 @@ def test_yahoo_DataReader(self):
278278
exp.index.name = 'Date'
279279
tm.assert_frame_equal(result.reindex_like(exp).round(5), exp.round(5))
280280

281+
282+
# test cases with "1/0" split ratio in actions- no split, just chnage symbol from POT to NTR
283+
start = datetime(2017, 12, 30)
284+
end = datetime(2018, 12, 30)
285+
286+
result = web.DataReader('NTR', 'yahoo-actions', start, end)
287+
288+
exp_idx = pd.DatetimeIndex(['2018-12-28', '2018-09-27',
289+
'2018-06-28', '2018-03-28',
290+
'2018-01-02'])
291+
292+
exp = pd.DataFrame({'action': ['DIVIDEND', 'DIVIDEND', 'DIVIDEND',
293+
'DIVIDEND', 'SPLIT'],
294+
'value': [0.43, 0.40, 0.40, 0.40, 1.00]},
295+
index=exp_idx)
296+
exp.index.name = 'Date'
297+
tm.assert_frame_equal(result.reindex_like(exp).round(2), exp.round(2))
298+
281299
@skip_on_exception(RemoteDataError)
282300
def test_yahoo_DataReader_multi(self):
283301
start = datetime(2010, 1, 1)

0 commit comments

Comments
 (0)