pandas.tseries.frequencies.to_offset
- pandas.tseries.frequencies.to_offset()
-
Return DateOffset object from string or tuple representation or datetime.timedelta object.
- Parameters
-
- freq:str, tuple, datetime.timedelta, DateOffset or None
- Returns
-
- DateOffset or None
- Raises
-
- ValueError
-
If freq is an invalid frequency
See also
DateOffset
-
Standard kind of date increment used for a date range.
Examples
>>> to_offset("5min") <5 * Minutes>
>>> to_offset("1D1H") <25 * Hours>
>>> to_offset("2W") <2 * Weeks: weekday=6>
>>> to_offset("2B") <2 * BusinessDays>
>>> to_offset(pd.Timedelta(days=1)) <Day>
>>> to_offset(Hour()) <Hour>
© 2008–2021, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.3.4/reference/api/pandas.tseries.frequencies.to_offset.html