I have a DataFrame with 1 minute timestamps, pw.
I have a monthly average of the values:
ma_pw=pw.groupby(BMonthEnd(+1).rollforward).aggregate(np.mean)
When I do a reindex to push that average back into all of the periods for the month,
the last day's values are NaN. Here's my reindex attempt:
reindexed = ma_pw.reindex(pw.index, method="backfill").
I have worked around this by forcing the hour in my monthly data to something past the last minute that I care about in my by-minute data as follows, but this seems incredibly crude:
from dateutil.relativedelta import *
newi = [x + relativedelta(hour=20) for x in ma_pw.index]
ma_pw.index = newi[:]
Then my original reindex works.
Is there a clean way to instruct the reindex method to include the datetime objects having the same datetime.date on that last day of the month?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4