1.

Consider the following dataframe, and answer the questions given below:import pandas as pddf = pd.DataFrame({“Quarter1":[2000, 4000, 5000, 4400, 10000], ""Quarter2":[5800, 2500, 5400, 3000, 2900],  "Quarter3":[20000, 16000, 7000, 3600, 8200],"Quarter4":[1400, 3700, 1700, 2000, 6000]})(i) Write the code to find mean value from above dataframedf over the index and column axis. (Skip NaN value)(ii) Use sum() function to find the sum of all the values over the index axis. (iii) Find the median of the dataframedf. 

Answer»

(i)  print(df.mean(axis = 1, skipna = True)) print(df.mean(axis = 0, skipna = True))

(ii)  print(df.sum(axis = 1, skipna = True))

(iii) print(df.median())



Discussion

No Comment Found

Related InterviewSolutions