xarray.infer_freq

xarray.infer_freq

xarray.infer_freq(index)[source]

Infer the most likely frequency given the input index.

Parameters

index (CFTimeIndex, DataArray, DatetimeIndex, TimedeltaIndex, Series) – If not passed a CFTimeIndex, this simply calls pandas.infer_freq. If passed a Series or a DataArray will use the values of the series (NOT THE INDEX).

Returns

str or None – None if no discernible frequency.

Raises
  • TypeError – If the index is not datetime-like.

  • ValueError – If there are fewer than three values or the index is not 1D.