cudf.date_range#
- cudf.date_range(start=None, end=None, periods=None, freq=None, tz=None, normalize: bool = False, name=None, inclusive: Literal['left', 'right', 'both', 'neither'] = 'both', *, unit: str | None = None)[source]#
Return a fixed frequency DatetimeIndex.
Returns the range of equally spaced time points (where the difference between any two adjacent points is specified by the given frequency) such that they all satisfy start <[=] x <[=] end, where the first one and the last one are, resp., the first and last time points in that range that are valid for freq.
- Parameters:
- startstr or datetime-like, optional
Left bound for generating dates.
- endstr or datetime-like, optional
Right bound for generating dates.
- periodsint, optional
Number of periods to generate.
- freqstr or DateOffset
Frequencies to generate the datetime series. Mixed fixed-frequency and non-fixed frequency offset is unsupported. See notes for detail. Supported offset alias:
D
,h
,H
,T
,min
,S
,U
,us
,N
,ns
.- tzstr or tzinfo, optional
Not Supported
- normalizebool, default False
Not Supported
- namestr, default None
Name of the resulting DatetimeIndex
- inclusive{“left”, “right”, “both”, “neither”}, default “both”
Whether to set each bound as closed or open. Currently only “both” is supported
- unitstr, default None
Specify the desired resolution of the result. Currently not supported.
- Returns:
- DatetimeIndex
Notes
Of the four parameters start, end, periods, and freq, exactly three must be specified. If freq is omitted, the resulting DatetimeIndex will have periods linearly spaced elements between start and end (inclusive on both sides).
cudf supports freq specified with either fixed-frequency offset (such as weeks, days, hours, minutes…) or non-fixed frequency offset (such as years and months). Specifying freq with a mixed fixed and non-fixed frequency is currently unsupported. For example:
>>> cudf.date_range( ... start='2021-08-23 08:00:00', ... freq=cudf.DateOffset(months=2, days=5), ... periods=5) ... NotImplementedError: Mixing fixed and non-fixed frequency offset is unsupported.
Examples
>>> cudf.date_range( ... start='2021-08-23 08:00:00', ... freq=cudf.DateOffset(years=1, months=2), ... periods=5) DatetimeIndex(['2021-08-23 08:00:00', '2022-10-23 08:00:00', '2023-12-23 08:00:00', '2025-02-23 08:00:00', '2026-04-23 08:00:00'], dtype='datetime64[ns]')