I have the following dataframe df
Local_Time_Dt Value 0 1999-02-22 07:30:00 1.5 0 1999-02-22 08:00:00 3.9 0 1999-02-22 08:30:00 3.9 0 1999-02-22 09:00:00 3.9 0 1999-02-22 09:30:00 2.0 ... ... 0 2023-03-03 11:30:00 0 0 2023-03-03 12:00:00 0 0 2023-03-03 12:30:00 0 0 2023-03-03 13:00:00 0 0 2023-03-03 13:30:00 0
The type of the column “Local_Time_Dt” is datetime64[ns]
(half-hourly) and Value
is float.
What I want to achieve to get the daily max Value
between “09:30:00” of previous day to “09:00:00” of current day instead of from “00:00:00” to “23:30:00”.
The problems are some days might miss the records which might stop the rolling function from working in this case; and some days might have duplicated half-hourly records due to daylight saving.
The desired output would be:
` Local_Time_Dt Value
0 1999-02-22 3.9
1 1999-02-23 4.0
… …
2023-03-03 0`
I am not sure what function I should use in Pandas.
Grassland Curing is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.