Return a fixed frequency TimedeltaIndex with day as the default. Parameters ---------- start : str or timedelta-like, default None Left bound for generating timedeltas. end : str or timedelta-like, default None Right bound for generating timedeltas. periods
(
start=None,
end=None,
periods: int | None = None,
freq=None,
name=None,
closed=None,
*,
unit: TimeUnit | None = None,
)
| 278 | |
| 279 | @set_module("pandas") |
| 280 | def timedelta_range( |
| 281 | start=None, |
| 282 | end=None, |
| 283 | periods: int | None = None, |
| 284 | freq=None, |
| 285 | name=None, |
| 286 | closed=None, |
| 287 | *, |
| 288 | unit: TimeUnit | None = None, |
| 289 | ) -> TimedeltaIndex: |
| 290 | """ |
| 291 | Return a fixed frequency TimedeltaIndex with day as the default. |
| 292 | |
| 293 | Parameters |
| 294 | ---------- |
| 295 | start : str or timedelta-like, default None |
| 296 | Left bound for generating timedeltas. |
| 297 | end : str or timedelta-like, default None |
| 298 | Right bound for generating timedeltas. |
| 299 | periods : int, default None |
| 300 | Number of periods to generate. |
| 301 | freq : str, Timedelta, datetime.timedelta, or DateOffset, default 'D' |
| 302 | Frequency strings can have multiples, e.g. '5h'. |
| 303 | name : Hashable, default None |
| 304 | Name of the resulting TimedeltaIndex. |
| 305 | closed : str, default None |
| 306 | Make the interval closed with respect to the given frequency to |
| 307 | the 'left', 'right', or both sides (None). |
| 308 | unit : {'s', 'ms', 'us', 'ns', None}, default None |
| 309 | Specify the desired resolution of the result. |
| 310 | If not specified, this is inferred from the 'start', 'end', and 'freq' |
| 311 | using the same inference as :class:`Timedelta` taking the highest |
| 312 | resolution of the three that are provided. |
| 313 | |
| 314 | .. versionadded:: 2.0.0 |
| 315 | |
| 316 | Returns |
| 317 | ------- |
| 318 | TimedeltaIndex |
| 319 | Fixed frequency, with day as the default. |
| 320 | |
| 321 | See Also |
| 322 | -------- |
| 323 | date_range : Return a fixed frequency DatetimeIndex. |
| 324 | period_range : Return a fixed frequency PeriodIndex. |
| 325 | |
| 326 | Notes |
| 327 | ----- |
| 328 | Of the four parameters ``start``, ``end``, ``periods``, and ``freq``, |
| 329 | a maximum of three can be specified at once. Of the three parameters |
| 330 | ``start``, ``end``, and ``periods``, at least two must be specified. |
| 331 | If ``freq`` is omitted, the resulting ``DatetimeIndex`` will have |
| 332 | ``periods`` linearly spaced elements between ``start`` and ``end`` |
| 333 | (closed on both sides). |
| 334 | |
| 335 | To learn more about the frequency strings, please see |
| 336 | :ref:`this link<timeseries.offset_aliases>`. |
| 337 |