Search code examples
pythonpython-3.xpandasdataframedata-analysis

Computing stats info for the entire year from a DataFrame


I have a data frame (similar to the one below) which roughly accounts for a year. enter image description here

..

..

..

enter image description here

The first column is info related date, second column is a code for identifying a particular item. May I know how to perform/get mean, median, mode etc related stats info for the entire year.

A MWE of the data can be found here.


Solution

  • With the help of @it_is_Chris, the problem got solved:

    df.groupby(df['EN'])[df.columns[2:]].agg(['mean', 'median'])