xarray.date_range
xarray.date_range#
- xarray.date_range(start=None, end=None, periods=None, freq='D', tz=None, normalize=False, name=None, closed=None, calendar='standard', use_cftime=None)[source]#
Return a fixed frequency datetime index.
The type (
xarray.CFTimeIndex
orpandas.DatetimeIndex
) of the returned index depends on the requested calendar and on use_cftime.- Parameters
start (
str
ordatetime-like
, optional) – Left bound for generating dates.end (
str
ordatetime-like
, optional) – Right bound for generating dates.periods (
int
, optional) – Number of periods to generate.freq (
str
orNone
, default:"D"
) – Frequency strings can have multiples, e.g. “5H”.tz (
str
ortzinfo
, optional) – Time zone name for returning localized DatetimeIndex, for example ‘Asia/Hong_Kong’. By default, the resulting DatetimeIndex is timezone-naive. Only valid with pandas DatetimeIndex.normalize (
bool
, default:False
) – Normalize start/end dates to midnight before generating date range.closed (
{"left", "right"}
orNone
, default:None
) – Make the interval closed with respect to the given frequency to the “left”, “right”, or both sides (None).calendar (
str
, default:"standard"
) – Calendar type for the datetimes.use_cftime (
boolean
, optional) – If True, always return a CFTimeIndex. If False, return a pd.DatetimeIndex if possible or raise a ValueError. If None (default), return a pd.DatetimeIndex if possible, otherwise return a CFTimeIndex. Defaults to False if tz is not None.
- Returns
CFTimeIndex
orpd.DatetimeIndex
See also