MCPcopy
hub / github.com/pandas-dev/pandas / date_range

Function date_range

pandas/core/indexes/datetimes.py:1249–1502  ·  pandas/core/indexes/datetimes.py::date_range

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 fall in the range `[start, end]` , where the first one and the last one are, resp., the

(
    start=None,
    end=None,
    periods=None,
    freq=None,
    tz=None,
    normalize: bool = False,
    name: Hashable | None = None,
    inclusive: IntervalClosedType = "both",
    *,
    unit: TimeUnit | None = None,
    **kwargs,
)

Source from the content-addressed store, hash-verified

1247
1248@set_module(class="st">"pandas")
1249def date_range(
1250 start=None,
1251 end=None,
1252 periods=None,
1253 freq=None,
1254 tz=None,
1255 normalize: bool = False,
1256 name: Hashable | None = None,
1257 inclusive: IntervalClosedType = class="st">"both",
1258 *,
1259 unit: TimeUnit | None = None,
1260 **kwargs,
1261) -> DatetimeIndex:
1262 class="st">"""
1263 Return a fixed frequency DatetimeIndex.
1264
1265 Returns the range of equally spaced time points (where the difference between any
1266 two adjacent points is specified by the given frequency) such that they fall in the
1267 range `[start, end]` , where the first one and the last one are, resp., the first
1268 and last time points in that range that fall on the boundary of ``freq`` (if given
1269 as a frequency string) or that are valid for ``freq`` (if given as a
1270 :class:`pandas.tseries.offsets.DateOffset`). If ``freq`` is positive, the points
1271 satisfy `start <[=] x <[=] end`, and if ``freq`` is negative, the points satisfy
1272 `end <[=] x <[=] start`. (If exactly one of ``start``, ``end``, or ``freq`` is *not*
1273 specified, this missing parameter can be computed given ``periods``, the number of
1274 timesteps in the range. See the note below.)
1275
1276 Parameters
1277 ----------
1278 start : str or datetime-like, optional
1279 Left bound for generating dates.
1280 end : str or datetime-like, optional
1281 Right bound for generating dates.
1282 periods : int, optional
1283 Number of periods to generate.
1284 freq : str, Timedelta, datetime.timedelta, or DateOffset, default &class="cm">#x27;D'
1285 Frequency strings can have multiples, e.g. &class="cm">#x27;5h'. See
1286 :ref:`here <timeseries.offset_aliases>` for a list of
1287 frequency aliases.
1288 tz : str or tzinfo, optional
1289 Time zone name for returning localized DatetimeIndex, for example
1290 &class="cm">#x27;Asia/Hong_Kong'. By default, the resulting DatetimeIndex is
1291 timezone-naive unless timezone-aware datetime-likes are passed.
1292 normalize : bool, default False
1293 Normalize start/end dates to midnight before generating date range.
1294 name : Hashable, default None
1295 Name of the resulting DatetimeIndex.
1296 inclusive : {class="st">"both", class="st">"neither", class="st">"left", class="st">"right"}, default class="st">"both"
1297 Include boundaries; Whether to set each bound as closed or open.
1298 unit : {&class="cm">#x27;sclass="st">', 'msclass="st">', 'usclass="st">', 'ns', None}, default None
1299 Specify the desired resolution of the result.
1300 If not specified, this is inferred from the &class="cm">#x27;startclass="st">', 'endclass="st">', and 'freq'
1301 using the same inference as :class:`Timestamp` taking the highest
1302 resolution of the three that are provided.
1303
1304 .. versionadded:: 2.0.0
1305 **kwargs
1306 For compatibility. Has no effect on the result.

Callers 15

setupMethod · 0.90
setupMethod · 0.90
setupMethod · 0.90
setupMethod · 0.90
setupMethod · 0.90
setupMethod · 0.90
setupMethod · 0.90
setupMethod · 0.90
setupMethod · 0.90
setupMethod · 0.90
setupMethod · 0.90
setupMethod · 0.90

Calls 2

_generate_rangeMethod · 0.45
_simple_newMethod · 0.45