Informatics Practices
To get top 5 rows of a DataFrame, you may use …………… function.
- head()
- head(5)
- top()
- top(5)
Python Pandas
2 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
3 Likes
Related Questions
To calculative cumulative sum of a column of a DataFrame, you may use …………… function.
- sum()
- sum(cumulative = True)
- cumsum()
- none of these
The function to get the index of maximum value in a column of DataFrame is …………… .
- max()
- index()
- idxmax()
- maxidx()
To get bottom 3 rows of a DataFrame, you may use …………… function.
- tail()
- tail(3)
- bottom()
- bottom(3)
Function …………… can be used to drop missing values.
- fillna()
- isnull()
- dropna()
- delna()