yfinance icon indicating copy to clipboard operation
yfinance copied to clipboard

Add 'keepna' argument

Open ValueRaider opened this issue 2 years ago • 4 comments

Keeping NaNs rows returned by Yahoo may be useful because the timepoints are still valid so provides list of trading intervals.

New argument keepna=False controls whether to keep/drop these NaN rows.

#1028 relevant

ValueRaider avatar Jul 14 '22 13:07 ValueRaider

This is breaking 30m, let me fix ...

ValueRaider avatar Jul 14 '22 22:07 ValueRaider

False alarm. 15m and 30m prices looking good.

ValueRaider avatar Jul 14 '22 22:07 ValueRaider

Might be good to include the following line in the impacted drop calls: https://github.com/ranaroussi/yfinance/blob/ec6279736b570815ec017691b428c90d910b1739/yfinance/base.py#L320

ProgrammingDao avatar Jul 18 '22 19:07 ProgrammingDao

Might be good to include the following line in the impacted drop calls:

https://github.com/ranaroussi/yfinance/blob/ec6279736b570815ec017691b428c90d910b1739/yfinance/base.py#L320

It should stay. Because how='all' is specified, then only if all columns are NaN are rows dropped. But ["Volume","Dividends","Stocks Splits"] should have their NaNs replaced with 0, so only with a yfinance bug would rows be dropped. We want to keep Yahoo NaNs, not buggy yfinance NaNs.

ValueRaider avatar Jul 20 '22 15:07 ValueRaider