I have a Dataframe with the index set to be the dates. I need to find the row (set of parameters for each month) where the value of the sensor is the minimum. The codes I tried are as following:
1.optimization = r.loc[[r.index.month == month]]
optimization=r.loc[r['Sensors'].idxmin()]
2.optimization=DataFrame(r.resample('M').Sensors.min())
3.optimization=r.loc[r['Sensors'].idxmin()]
4.optimization= r.loc[r.groupby([r.index.month == month])["Sensors"].idxmin()]
My datat farme:
Index ACH_Base Am Energy Sensors
2017_01_31 0.3 0.9 2.2989e+11 39087428391.1
2017_01_31 0.5 0.8 2.29892e+11 37142574944.9
....
2017_02_28 0.7 0.9 2.40001e+11 38568420286.9
2017_02_28 0.3 0.7 2.7136+11 36945759284.8
....
Thanks!