Description
From the bottom of the reindex docs here; relevant docs source here:
The index entries that did not have a value in the original data frame (for example, ‘2009-12-29’) are by default filled with NaN. If desired, we can fill in the missing values using one of several options.
For example, to backpropagate the last valid value to fill the NaN values, pass bfill as an argument to the method keyword.
>>> df2.reindex(date_index2, method='bfill')prices 2009-12-29 100 2009-12-30 100 2009-12-31 100 2010-01-01 100 2010-01-02 101 2010-01-03 NaN 2010-01-04 100 2010-01-05 89 2010-01-06 88 2010-01-07 NaN
Please note that the
NaN
value present in the original dataframe
(at index value 2010-01-03) will not be filled by any of the
value propagation schemes. This is because filling while reindexing
does not look at dataframe values, but only compares the original and
desired indexes. If you do want to fill in theNaN
values present
in the original dataframe, use thefillna()
method.
Problem description
Couldn't find any duplicates during search (but hard to say it isn't out there somewhere).
This is a question as much as anything. It may be my ignorance, or perhaps an oversight in the docs. The last value in the output shows 2010-01-07 NaN
. It was not part of the original dataframe, so based on the note, it seems that it too should be auto-filled like the first 3 values were. I understand why 2010-01-03 NaN
was not populated, but it doesn't seem right for the last value. Unless there is something I'm missing.
https://pandas-docs.github.io/pandas-docs-travis/
^^
FYI, this link from the issue template is giving a 404