English

Mumbai 29 21 35.2 Kolkata 39 23 41.8 Which of the following command will display the sum of every column of the data frame?

Advertisements
Advertisements

Question

Consider the following DataFrame df and answer the following query.

City Max temp Min Temp 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

Which of the following command will display the sum of every column of the data frame? 

Options

  • print(df. sum(axis = 1))

  • print(df. sum(axis = column))

  • print( df. sum(),axis = 1)

  • print(df. sum())

MCQ
Advertisements

Solution

print(df. sum())

Explanation:

The data frame's column-wise sum will be calculated using df. sum().

shaalaa.com
Descriptive Statistics
  Is there an error in this question or solution?
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×