I want to resample a dataset, the minimum date of each series should be the same for each series, therefore, the minimum date of each series should be the minimum value for the date column. Same for the maximum date (Instead of resampling at series level, I want to resample taking the global maximum value).
And this, opens a new question, how do I specify when resampling that the null values that I want a 0.
I mean, suppose this case:
series col | date | value |
---|---|---|
series_1 | 2023-02-06 | 5 |
series_1 | 2023-02-23 | 7 |
If you notice, I miss the series in between: (resampling on weeks)
series col | date | value |
---|---|---|
series_1 | 2023-02-13 | 0 |
I'm wondering what is the following code doing? how is filling that value? Because I have not specified anything and I don't see null values when I'm resampling.pandas documentation
df.groupby('series_col').resample('W', on='date', label='left', loffset=pd.DateOffset(days=0))['value'].sum().reset_index()