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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/pandas/dataframe/dataframe-last.php