Pandas DataFrame: first() function

DataFrame - first() function

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


DataFrame.first(self, offset)


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


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - filter() function
Next: DataFrame - last() function

Follow us on Facebook and Twitter for latest update.