Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
BUG/ER: Stricter testing of 'monotocity' when reindexing with ffill or bfill. #4483
Reversing an index and forward filling succeeds but produces misleading data:
>>> dr = pd.date_range('2013-08-01', periods=6, freq='B') >>> df = pd.DataFrame(np.random.randn(6,1), index=dr, columns=list('A')) >>> df['A'] = np.nan >>> df.reindex(df.index[::-1], method='ffill') A 2013-08-08 2.127302 2013-08-07 NaN 2013-08-06 NaN 2013-08-05 NaN 2013-08-02 NaN 2013-08-01 NaN
This change enforces "monotocity" (well actually weakly increasing) and causes a ValueError to be raised.
Can you also add an example of how to do this in the missing_data.rst ? (and maybe a pointer from the cookbook)?
also need release notes (put in the API section), reference the issue #4484
This is the solution (but yours is nice on error reporting!)