Q. Given a data frame df1 as shown below:


City    MaxTemp    MinTemp    RainFall
Delhi    40    32    24.1
Bengaluru    31    25    36.2
Chennai    35    27    40.8
Mumbai    29    21    35.2
Kolkata    39    23    41.8


(i) Write command to compute sum of every column of the data frame.

(ii) Write command to compute mean of column Rainfall.

(iii) Write command to compute Median of the Max Temp Column.


Answer :-


(i)

df1.sum()


(ii)

df1['RainFall'].mean()


(iii)

df1.loc[:, 'MaxTemp'].median()

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post