pandas.date_range
pandas 3.1.1 · General functions · function
Generate timestamps on a regular schedule and return a DatetimeIndex.
Call syntax
pd.date_range(…) Full signature
pd.date_range(
start=None,
end=None,
periods=None,
freq=None,
tz=None,
normalize=False,
name=None,
inclusive='both',
*,
unit=None,
ambiguous='raise',
nonexistent='raise',
**kwargs,
)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
start |
Optional Positional or keyword Default None |
str or datetime-like Supply the start point of a range, slice, or calculation. |
end |
Optional Positional or keyword Default None |
str or datetime-like Supply the endpoint of the range or calculation. |
periods |
Optional Positional or keyword Default None |
int Set a count of generated observations or the number of steps to shift or compare. |
freq |
Optional Positional or keyword Default None |
str, Timedelta, datetime.timedelta, or DateOffset Specify the frequency or offset, such as "D" for a day or "MS" for a calendar month start. |
tz |
Optional Positional or keyword Default None |
str or tzinfo Supply a timezone name or timezone object. |
normalize |
Optional Positional or keyword Default False |
bool Request normalized output, such as proportions for counts or midnight for datetimes. |
name |
Optional Positional or keyword Default None |
Hashable Set a name or identify the named object used by the operation. |
inclusive |
Optional Positional or keyword Default 'both' |
{"both", "neither", "left", "right"} Choose whether the start, end, both, or neither boundary is included. |
unit |
Optional Keyword only Default None |
{'s', 'ms', 'us', 'ns', None} Specify the time unit represented by each number or required by the result. |
ambiguous |
Optional Keyword only Default 'raise' |
'infer', bool-ndarray, 'NaT' Resolve local times that occur twice when clocks move backward. |
nonexistent |
Optional Keyword only Default 'raise' |
'shift_forward', 'shift_backward', 'NaT', timedelta Resolve local times skipped when clocks move forward. |
**kwargs |
Optional Additional keyword arguments |
Returns
DatetimeIndex