So my df is per minute readings from sensor. I want to find slopes for every hour readings, meaning every 1 hour should have 1 slope value. How to I do that?
I've tried groupby.apply linregress , not working, also tried to groupby 60 rows, but that just gives mean values for the hour. Column 1 is T_a and Column 2 is Q_a. I want slope values for T_am vs Q_a for every hour.
df.head()
2019-01-09 17:03:00 3.09125 93.353877
2019-01-09 17:04:00 3.08575 89.513643
2019-01-09 17:05:00 3.10325 92.700350
2019-01-09 17:06:00 3.08075 91.089470
2019-01-09 17:07:00 3.08200 92.563898
df = df.groupby(index).apply(lambda df: linregress(df.T_am, df.Q_a)[0])
KeyError: Timestamp('2019-01-09 18:02:00')