I have a column in pandas data frame where I want to find out the min and max of a column in the same result. But the problem is I am getting only one aggregated value in return.
import pandas as pd
print(df)
col1 col2
5 9
6 6
3 4
4 3
df.agg({'col1':'sum','col1':'mean'})
The output of this aggregation is giving only mean :
col1 4.5
dtype: float64
However, the output which I need should have both sums and mean for col1 and I am only getting mean.
df.col1.agg(['sum','mean'])?select max(col1), sum(col1) from df;I get two different columns in my output for max and sum, I want same here as well.