I have to make a group by very simple but it does not work in my case. I can not reproduce the actual data but suppose that my DF is:
Cod Cost Date VAL
0 A123 123 2017-12-21 0.0
1 A123 123 2017-12-21 -2.0
2 A123 123 2017-12-21 -10.0
3 FB00 180 2016-12-11 80.0
4 FB00 180 2016-12-11 80.0
I have to make a groupby for Cod, Cost and Date and get the corresponding minimum of VAL with reset_index(). My code is:
DF = DF.groupby(['Cod', 'Cost','Date'])['VAL'].min().reset_index()
the expected is:
Cod Cost Date VAL
0 A123 123 2017-12-21 -10.0
1 FB00 180 2016-12-11 80.0
but it return:
Cod Cost Date VAL
0 A123 123 2017-12-21 0.0
1 A123 123 2017-12-21 0.0
2 A123 123 2017-12-21 80.0
3 FB00 180 2016-12-11 80.0
4 FB00 180 2016-12-11 80.0