Anjeev Singh Academy

Anjeev Singh Academy

Class 12 IP 065 Ch 2 Python Pandas II Type A Very Short Sumita Arora Book Questions Answer

Chapter 2 : Python Pandas – II

Sumita Arora Book Exercise Solution of Class 12 Informatics Practices [065]

Type A – Very Short Questions Answers


1. Name the function to iterate over a DataFrame horizontally.

Ans: iterrows( )

2. Name the function to iterate over a DataFrame vertically.

Ans: iteritem( )

3. Write equivalent expressions for the given functions

(i) A.add(B). 

(ii) B.add(A)             

(iii) A.sub(B)            

(iv) B.sub(A)

(v) A.rsub(B)

(vi) B.mul(A)

(vii) A.rdiv(B)

(viii) B.div(A)

(ix) B.rdiv(A)

(x) A.div(B)

Ans: (i) A + B           (ii) B + A          

(iii) A – B          (iv) B – A

(v) B + A          (vi) B * A         

(vii) B / A          (viii) B / A

(ix) A / B           (x) A / B

4. Is the result of sub( ) and rsub( ) the same? Why/why not?

Ans: NO. Because A.sub(B) means A – B while A.rsub(B) means B – A.

5. Write appropriate functions to perform the following on a DataFrame?

(i)   Calculate the sum 

(ii) Count the values

(iii) Calculate the average        

(iv) Calculate the most repeated value

(v)  Calculate the median          

(vi) Calculate the standard deviation

(vii) Calculate the variance 

(viii) Calculate the maximum value

(ix) Calculate the standard deviation  

(x) Calculate the variance

Ans: (i)   Calculate the sum                       –       sum( )     

(ii)  Count the values                         –       count()

(iii) Calculate the average                   –       mean()

(iv) Calculate the most repeated value –      mode()    

(v)  Calculate the median                   –       median()

(vi) Calculate the standard deviation   –       std( )

(vi) Calculate the variance                  –       var()

(viii) Calculate the maximum value     –       max()

(ix) Calculate the standard deviation   –       std()

(x) Calculate the variance                   –       var( )

6. What does info() and describe( ) do ?

Ans: info( ) Function:

The info( ) function is used to inspect broadly or to get basic information about the dataframe object.

                df.info( )

The info( ) gives information like – type, index values, number of rows, data column and values in them, datatypes of each column and memory usages.

The describe( ) Function:

The describe( ) function gives the descriptive statistics details of a dataframe object. It works on numeric columns.

The describe( ) functions gives information like – Count, Mean, Std, minimum, maximum, and quartiles.

7. Are sum() and add( ) functions the same ?

Ans: No. The sum( ) function returns the sum of the values for the requested axis, while add( ) function perform the add binary operation on the two dataframes i.e. returns the sum of two dataframes.

8. Name some functions that perform descriptive statistics on a DataFrame.

Ans: Descriptive functions are – min(), max(), mode(), mean(), median(), count(), sum(), quantile(), std(), var(), describe()

9. To consider only the numeric values for calculation, what argument do you pass to statistics functions of Pandas?

Ans: numeric_only argument.

10. Is there one function that calculates much of descriptive statistics values? Name it.

Ans: Yes. The name of function is describe( ) .

11. What happens if mode() returns multiple values for a column but other columns have a single mode ?

Ans: In this case, the mode( ) function will display multiple rows to show multiple modes for the mode’s columns and for the the rest it will display (fill) NaN value.

12. What is quantile and quartile?

Ans: Qunatile: The equally divided parts of a distribution is called quantile.

Quartile: When distribution is divided into four equal parts, then the dividing marker is called quartile.

13. Name the function that lets you calculate different types of quantiles.

Ans: quantile()

14. Name the functions that give you maximum and minimum values in a DataFrame.

Ans: max( ) and min( )

15. Name the functions that give you the index of maximum and minimum values in a DataFrame.

Ans: idmax( ) and idmin()

16. What is pivoting? Name the two functions that you can use for pivoting.

Ans: Pivoting is a summarizing technique to rearrange the column and rows in report

  • by rotating rows or columns or
  • by aggregating data from multiple sources.

17. What is the basic difference between pivot( ) and pivot_table( ) ?

Ans: pivot( ) function work on one quarter of data while pivot_table( ) can works on multiple quarters of data.

In case of multiple entries of a row, column combination, pivot( ) function raise an error while pivot_table( ) function does not.

18. What is missing data?

Ans: Missing Data or values are the values that cannot contribute to any computation i.e. not having computational significance.

19. Why is missing data filled in DataFrame with some value?

Ans: To get the accurate mean values or result, it is necessary to fill the missing data with some value. Otherwise it will affect the overall result.

20. Name the functions you can use for filling missing data.

Ans: fillna( )

21. Name the function to create histogram from a DataFrame.

Ans: df.hist() with kind argument is having ‘hist’ value.

22. Name some functions used to handle missing data in dataframes,

Ans: isnull( ) – to detect missing data, dropna( ) – to drop missing values, fillna( ) – to fill the missing value.

23. Name some functions used to join or combine dataframes.

Ans: concat(), join(), and merge()

24. Name two functions that can produce result similar to SQL joins.

Ans: join( ) and merge( )


Class 12 Informatics Practices [065] – Sumita Arora Book Exercise Solution


Sumita Arora Solution


Sorry! You cannot copy content of this page. Please contact, in case you want this content.

Scroll to Top