Pandas DataFrame: asfreq() function
DataFrame - asfreq() function
The asfreq() function is used to convert TimeSeries to specified frequency.
Syntax:
DataFrame.asfreq(self, freq, method=None, how=None, normalize=False, fill_value=None)
Parameters:
Name | Description | Type / Default Value | Required / Optional |
---|---|---|---|
freq | DateOffset object, or string | Required | |
method | Method to use for filling holes in reindexed Series (note this does not fill NaNs that already were present):
|
{‘backfill’/’bfill’, ‘pad’/’ffill’} Default Value: None |
Required |
how | For PeriodIndex only, see PeriodIndex.asfreq | {‘start’, ‘end’} Default Value: end |
Required |
normalize | Whether to reset output index to midnight | bool Default Value: False |
Required |
fill_value | Value to use for missing values, applied during upsampling (note this does not fill NaNs that already were present). | scalar | Optional |
Returns: converted - same type as caller
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame - update() function
Next: DataFrame - asof() 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