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.
Syntax:
Series.last(self, offset)[source]
Parameters:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
offset | string, DateOffset Default Value: relativedelta |
Required |
Returns: subset - same type as caller
Raises: TypeError
If the index is not a DatetimeIndex
Example:
Download the Pandas Series Notebooks from here.
Previous: Find values contained in Pandas series
Next: Conform series in Pandas
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework