How do I resample a time series in pandas to a weekly frequency where the weeks start on an arbitrary day? I see that there's an optional keyword base but it only works for intervals shorter than a day.
Andy Hayden
You can pass anchored offsets to resample, among other options they cover this case.
For example the weekly frequency from Monday:
ts.resample('W-MON')
You will be much safer with resampling based on days and then slicing every 7th day, e.g:
ts.resample('D').interpolate()[::7]
See the underlying problem with other approaches in this open pandas issue on github:
来源:https://stackoverflow.com/questions/14530556/resample-time-series-in-pandas-to-a-weekly-interval