How to get the top n rows of a pandas DataFrame in Python

Getting the top n rows of a pandas.DataFrame returns a new DataFrame containing only the first n rows of the original.

Solution for How to get the top n rows of a pandas DataFrame in Python : You can use pandas.DataFrame.head() to get the top n rows of a DataFrame Call pandas.DataFrame.head(n) to get a DataFrame containing only the first n rows of pandas.DataFrame.


how-to-get-the-top-n-rows-of-a-pandas-dataframe-in-python