CBSE Class 12 Informatics Practices
Question 154 of 167
Python Pandas — I — Question 8
Back to all questions 8
Question Consider the following DataFrame df and answer any four questions from (i)-(v):
| rollno | name | UT1 | UT2 | UT3 | UT4 |
|---|---|---|---|---|---|
| 1 | Prerna Singh | 24 | 24 | 20 | 22 |
| 2 | Manish Arora | 18 | 17 | 19 | 22 |
| 3 | Tanish Goel | 20 | 22 | 18 | 24 |
| 4 | Falguni Jain | 22 | 20 | 24 | 20 |
| 5 | Kanika Bhatnagar | 15 | 20 | 18 | 22 |
| 6 | Ramandeep Kaur | 20 | 15 | 22 | 24 |
Which of the following statement/s will give the exact number of values in each column of the dataframe ?
(I) print(df.count())
(II) print(df.count(0))
(III) print(df.count)
(IV) print((df.count(axis = 'index')))
Choose the correct option :
(a) both (I) and (II)
(b) only (II)
(c) (I), (II) and (III)
(d) (I), (II) and (IV)
(I), (II) and (IV)
In pandas, the statement df.count() and df.count(0) calculate the number of non-null values in each column of the DataFrame df. The statement df.count(axis='index') specifies the axis parameter as 'index', which is equivalent to specifying axis=0. This means it will count non-null values in each column of the DataFrame df.