pyspark.pandas.Series.tail

Series.tail(n: int = 5) → pyspark.pandas.series.Series[source]

Return the last n rows.

This function returns last n rows from the object based on position. It is useful for quickly verifying data, for example, after sorting or appending rows.

For negative values of n, this function returns all rows except the first n rows, equivalent to df[n:].

Parameters
nint, default 5

Number of rows to select.

Returns
type of caller

The last n rows of the caller object.

See also

DataFrame.head

The first n rows of the caller object.

Examples

>>> psser = ps.Series([1, 2, 3, 4, 5])
>>> psser
0    1
1    2
2    3
3    4
4    5
dtype: int64
>>> psser.tail(3)  
2    3
3    4
4    5
dtype: int64