Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

Pandas DataFrame: last() function

DataFrame - last() function

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

Syntax:

DataFrame.last(self, offset)

Parameters:

Name Description Type/Default Value Required / Optional
offset                    

 

string, DateOffset, dateutil.relativedelta Required

Returns: subset - same type as caller

Raises: TypeError
If the index is not a DatetimeIndex

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - first() function
Next: DataFrame - reindex_like() function