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.
Syntax:
DataFrame.first(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 - filter() function
Next: DataFrame - last() function
- 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