Pandas Series: last() function

Subsetting final periods of time in Pandas series

The last() function (convenience method ) is used to subset final periods of time series data based on a date offset.

Return a boolean Series showing whether each element in the Series matches an element in the passed sequence of values exactly.


Series.last(self, offset)[source]
Pandas Series last image


Name Description Type/Default Value Required / Optional
offset string, DateOffset
Default Value: relativedelta

Returns: subset - same type as caller

Raises: TypeError
If the index is not a DatetimeIndex


Download the Pandas Series Notebooks from here.

Previous: Find values contained in Pandas series
Next: Conform series in Pandas

Share this Tutorial / Exercise on : Facebook and Twitter