- Home
- Python Home
- ▼Python Pandas Tutorials
- Pandas Home
- ▼Pandas DataFrame Constructor
- Pandas DataFrame Home
- ▼Pandas DataFrame Attributes
- ▼DataFrame Indexing, iteration
- DataFrame.head()
- DataFrame.at()
- DataFrame.iat()
- DataFrame.loc()
- DataFrame.iloc()
- DataFrame.items()
- DataFrame.iteritems()
- DataFrame.iterrows()
- DataFrame.itertuples()
- DataFrame.lookup()
- DataFrame.pop()
- DataFrame.tail()
- DataFrame.xs()
- DataFrame.isin()
- DataFrame.where()
- DataFrame.mask()
- DataFrame.query()
- ..More to come..
DataFrame - head() function
The head() function is used to get the first n rows.
This function returns the first n rows for the object based on position. It is useful for quickly testing if your object has the right type of data in it.
Syntax:
DataFrame.head(self, n=5)
Parameters:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
n | Number of rows to select. | int Default Value: 5 | Required |
Returns: obj_head : same type as caller
The first n rows of the caller object.
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame - notna() function
Next: DataFrame - at() function
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics