xarray.infer_freq

xarray.infer_freq(index)

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

None if no discernible frequency.

Return type

str or None

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

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