KnowledgeBoat Logo
|

Informatics Practices

Consider the following DataFrame df and answer any four questions from (i)-(v):

rollnonameUT1UT2UT3UT4
1Prerna Singh24242022
2Manish Arora18171922
3Tanish Goel20221824
4Falguni Jain22202420
5Kanika Bhatnagar15201822
6Ramandeep Kaur20152224

Which of the following command will display the column labels of the DataFrame ?

(a) print(df.columns())

(b) print(df.column())

(c) print(df.column)

(d) print(df.columns)

Python Pandas

3 Likes

Answer

print(df.columns)

Explanation

The statement df.columns is used to access the column labels (names) of a DataFrame in pandas.

Answered By

3 Likes


Related Questions