Computer Science, asked by HumanCalculator888, 8 months ago

Consider the following dataframe, and answer the questions given below: import pandas as pd df = 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.

Answers

Answered by prathmeshSingh1234
0

the median of the data framedf is =(5800, 2500, 5400, 3000, 2900 )

Answered by bestwriters
3

(i) Mean value over the index and column axis:

The syntax to print is:

print(df.mean(axis = n, skipna = True/false))

Where,

n = Number of the axis

To print the index axis below code is used:

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

To print the column axis below code is used:

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

(ii) Sum of all the values over the index axis:

The sum is the total of the values in the index axis. The below code prints the sum of the values in index axis.

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

(iii) Median of the dataframedf:

The median defines the mid value in the group of given values. The below code prints the middle value in the given dataframe.

print(df.median())

Similar questions