0

I have a similar question to this: Getting the monthly maximum of a daily dataframe with the corresponding index value but cannot install from pandas.io.data import DataReader. My original dataframe is:

df
Datum      ID Value
01.01.2020   1  2
02.01.2020   1  1
01.02.2020   1  3
01.01.2020   2  2
01.02.2020   2  0

And i groupby the Dates to get the total value per everydate:

df.groupby('Datum')['Value'].sum().reset_index()
Datum       Value
01.01.2020   4
02.01.2020   2
01.02.2020   2

How can I pick the maximum per month in that case? I mean the 01.01.2020 and 01.02.2020.

so the output should be:

Datum       Value
01.01.2020   4
01.02.2020   2

or a list with the dates: alist = ['01.01.2020', '01.02.2020']

PV8
  • 5,799
  • 7
  • 43
  • 87

0 Answers0