(Jun-07-2020, 10:13 AM)scidam Wrote: What are column types (date and time)?
If they are of DateTime dtype (datetime64[ns]), you can do this using groupby, e.g.
df.groupby('date')['high'].max() # get max values of 'high' column for each day
df.groupby('date')['high'].min() # get min values of 'high' column for each day
df.groupby([df.date, df.time.dt.hour])['high'].max() # get max values of 'high' column for each hour (during the day)
Thanks scidam for your quick reply.
I am kind of stuck here. I want to have the output displayed all in 2 lines day by day like the following.
Date, Time, High
Date, Time, Low
How could I write it in such a way to achieve that ? many thanks. I went thru many Youtube videos on groupby, but I am not able to find groupby with multiple columns outputs with different calculation criteria(Max of High and Min of Low in this case.)
data type originally
Then I converted the Date and Time to datetime64 format. Not sure if I made it better or worse?