Pandas .resample() creates dates that weren't present in the original Data Frame

Viewed 214

I am trying to resample Data Frame from daily to monthly frequencies. The last date of my original Data Frame is 2020-03-17. Original Data Frame. I'm doing the resampling in the following way: df.resample('M').mean(). As a result I obtain the Data Frame with dates up to 2020-12-31, so basically resampling adds more than a half a year of nonexistent dates. Data Frame after resampling I tried to play around with parameters "closed" and "label" but didn't achieve any success. Any ideas what I'm doing wrong? Thanks in advance!

0 Answers
Related