The tail() method in Pandas

The tail() method is used to return the last n rows from a series/dataframe.

Syntax a) pandas.DataFrame.tail(n=5)
b) pandas.Series.tail(n=5)

Example: We want to return the last three rows from the dataframe.

Python

mydata=pd.read_csv("employees.csv")
# mydata.tail(n=3)
# mydata.tail()
mydata.tail(3) 

The output of the above code is shown below:

tail() method in Pandas