I need to calculate different mathematical operations to the different variables in dataframe. I am having data as shown below:
y x1 x2 x3
NB 1 4 2
SK 2 5 3
SK 3 6 6
NB 4 7 9
I want to group mydata with y variable and have to calculate sum(x1),max(x2).Also, I have to apply some user_defined function to x3.
And I want my grouped output with only 4 variables y,x1,x2,x3 in pandas dataframe format as shown below.
y x1 x2 x3
NB 5 7 5
SK 5 6 5
I tried some codes and i searched in different websites but i didn't get a required solution.
please anyone help me to tackle this.
Thanks in advance.