i have a dataframe (df) indexed by dates (freq: 15 minutes): (little example)
datetime | Value |
---|---|
2019-09-02 16:15:00 | 0.00 |
2019-09-02 16:30:00 | 3.07 |
2019-09-02 16:45:00 | 1.05 |
And i want to resample my dataframe to freq: 1 month. Also I need calculate the min value in this month reaching this:
df_min = df.resample('1M').min()
Up to this point, all good but i need the min value not be 0, so i want something like min(i>0) but i dont know how to get it
here is one way to do it
assumption: datetime is an index
# make the 0 as nan and take the min
df_min= df.replace(0, np.nan).resample('1M').min()
Value
datetime
2019-09-30 1.05