KnowledgeBoat Logo
|

Informatics Practices

To get top 5 rows of a DataFrame, you may use …………… function.

  1. head()
  2. head(5)
  3. top()
  4. top(5)

Python Pandas

3 Likes

Answer

head(), head(5)

Reason — The head() function in pandas is used to get the top n rows of a DataFrame, where n is an optional argument. If n is not provided, it defaults to 5. Hence, both head() and head(5) are correct and will return the top 5 rows of the DataFrame.

Answered By

2 Likes


Related Questions