Closed
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
price = [np.NaN, 10, 13, np.NaN, np.NaN, 9]
df = pd. DataFrame(price, columns = ['price'])
period = 1
pct = df.price.pct_change(periods=period, fill_method=None)
print(pct)
# https://stackoverflow.com/questions/75395345/how-to-avoid-bfill-or-ffill-when-calculating-pct-change-with-nans
Issue Description
There's a code path specifically for fill_method=None
:
Lines 10904 to 10905 in 13db83a
But no test hits it (check pandas-coverage.herokuapp.com/), and the type hints don't allow None
Expected Behavior
This was recently added to the docs #51262 - seeing as it does work, it should probably be tested, type hints updated, and documented?
Installed Versions
Replace this line with the output of pd.show_versions()