Skip to main content

Python Pandas Series: tail() function

In Pandas tail() function is similar to head() function. It is also used to explore data structures or data of a series without producing all of it. Alike head() function it is also a very convenient easy and quick method to try with data without actually dumping into it.

This function is used to return n rows from bottom of a dataframe or series.

Syntax

series.tail(n=5)

n: The number of rows. By Default n=5

Return: Series with bottom n rows.

Example

import pandas as pd

series_0=pd.Series([i for i in range(50)])

When n=10

series_0.tail(10)

Output

40    40
41    41
42    42
43    43
44    44
45    45
46    46
47    47
48    48
49    49
dtype: int64

When n is not given

series_0.tail()

Output:

45    45
46    46
47    47
48    48
49    49
dtype: int64
Submitted by devanshi.srivastava on November 3, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.