class_docstr: Forecasting horizon.
  
  Parameters
  ----------
  values : pd.Index, pd.TimedeltaIndex, np.array, list, pd.Timedelta, or int
      Values of forecasting horizon
  is_relative : bool, optional (default=None)
      - If True, a relative ForecastingHorizon is created:
              values are relative to end of training series.
      - If False, an absolute ForecastingHorizon is created:
              values are absolute.
      - if None, the flag is determined automatically:
          relative, if values are of supported relative index type
          absolute, if not relative and values of supported absolute index type
  freq : str, pd.Index, pandas offset, or sktime forecaster, optional (default=None)
      object carrying frequency information on values
      ignored unless values is without inferable freq
  
  Examples
  --------
  >>> from sktime.forecasting.base import ForecastingHorizon
  >>> from sktime.forecasting.naive import NaiveForecaster
  >>> from sktime.datasets import load_airline
  >>> from sktime.split import temporal_train_test_split
  >>> import numpy as np
  >>> y = load_airline()
  >>> y_train, y_test = temporal_train_test_split(y, test_size=6)
  
      List as ForecastingHorizon
  
  >>> ForecastingHorizon([1, 2, 3])  # doctest: +SKIP
  >>> # ForecastingHorizon([1, 2, 3], is_relative=True)
  
      Numpy as ForecastingHorizon
  
  >>> ForecastingHorizon(np.arange(1, 7))  # doctest: +SKIP
  >>> # ForecastingHorizon([1, 2, 3, 4, 5, 6], is_relative=True)
  
      Absolute ForecastingHorizon with a pandas Index
  
  >>> ForecastingHorizon(y_test.index, is_relative=False) # doctest: +SKIP
  >>> # ForecastingHorizon(['1960-07', ..., '1960-12'], is_relative=False)
  
      Converting
  
  >>> # set cutoff (last time point of training data)
  >>> cutoff = y_train.index[-1]
  >>> cutoff
  Period('1960-06', 'M')
  >>> # to_relative
  >>> fh = ForecastingHorizon(y_test.index, is_relative=False)
  >>> fh.to_relative(cutoff=cutoff)  # doctest: +SKIP
  >>> # ForecastingHorizon([1, 2, 3, 4, 5, 6], is_relative=True)
  
  >>> # to_absolute
  >>> fh = ForecastingHorizon([1, 2, 3, 4, 5, 6], is_relative=True)
  >>> fh = fh.to_absolute(cutoff=cutoff) # doctest: +SKIP
  >>> # ForecastingHorizon(['1960-07', ..., '1960-12'], is_relative=False)
  
      Automatically casted ForecastingHorizon from list when calling predict()
  
  >>> forecaster = NaiveForecaster(strategy="drift")
  >>> forecaster.fit(y_train)
  NaiveForecaster(...)
  >>> y_pred = forecaster.predict(fh=[1,2,3])
  >>> forecaster.fh  # doctest: +SKIP
  >>> # ForecastingHorizon([1, 2, 3], dtype='int64', is_relative=True)
  
      This is identical to give an object of ForecastingHorizon
  
  >>> y_pred = forecaster.predict(fh=ForecastingHorizon([1,2,3]))
  >>> forecaster.fh  # doctest: +SKIP
  >>> # ForecastingHorizon([1, 2, 3], dtype='int64', is_relative=True)
class_docstr_tok: ["Forecasting","horizon",".","Parameters","--","--","--","--","--","values",":","pd.Index",",","pd.TimedeltaIndex",",","np.array",",","list",",","pd.Timedelta",",","or","int","Values","of","forecasting","horizon","is_relative",":","bool",",","optional","(","default=None",")","-","If","True",",","a","relative","ForecastingHorizon","is","created",":","values","are","relative","to","end","of","training","series",".","-","If","False",",","an","absolute","ForecastingHorizon","is","created",":","values","are","absolute",".","-","if","None",",","the","flag","is","determined","automatically",":","relative",",","if","values","are","of","supported","relative","index","type","absolute",",","if","not","relative","and","values","of","supported","absolute","index","type","freq",":","str",",","pd.Index",",","pandas","offset",",","or","sktime","forecaster",",","optional","(","default=None",")","object","carrying","frequency","information","on","values","ignored","unless","values","is","without","inferable","freq","Examples","--","--","--","--",">",">",">","from","sktime.forecasting.base","import","ForecastingHorizon",">",">",">","from","sktime.forecasting.naive","import","NaiveForecaster",">",">",">","from","sktime.datasets","import","load_airline",">",">",">","from","sktime.split","import","temporal_train_test_split",">",">",">","import","numpy","as","np",">",">",">","y","=","load_airline","(",")",">",">",">","y_train",",","y_test","=","temporal_train_test_split","(","y",",","test_size=6",")","List","as","ForecastingHorizon",">",">",">","ForecastingHorizon","(","[","1",",","2",",","3","]",")","#","doctest",":","+SKIP",">",">",">","#","ForecastingHorizon","(","[","1",",","2",",","3","]",",","is_relative=True",")","Numpy","as","ForecastingHorizon",">",">",">","ForecastingHorizon","(","np.arange","(","1",",","7",")",")","#","doctest",":","+SKIP",">",">",">","#","ForecastingHorizon","(","[","1",",","2",",","3",",","4",",","5",",","6","]",",","is_relative=True",")","Absolute","ForecastingHorizon","with","a","pandas","Index",">",">",">","ForecastingHorizon","(","y_test.index",",","is_relative=False",")","#","doctest",":","+SKIP",">",">",">","#","ForecastingHorizon","(","[","'1960-07","'",",","...",",","'1960-12","'","]",",","is_relative=False",")","Converting",">",">",">","#","set","cutoff","(","last","time","point","of","training","data",")",">",">",">","cutoff","=","y_train.index","[","-1","]",">",">",">","cutoff","Period","(","'1960-06","'",",","'M","'",")",">",">",">","#","to_relative",">",">",">","fh","=","ForecastingHorizon","(","y_test.index",",","is_relative=False",")",">",">",">","fh.to_relative","(","cutoff=cutoff",")","#","doctest",":","+SKIP",">",">",">","#","ForecastingHorizon","(","[","1",",","2",",","3",",","4",",","5",",","6","]",",","is_relative=True",")",">",">",">","#","to_absolute",">",">",">","fh","=","ForecastingHorizon","(","[","1",",","2",",","3",",","4",",","5",",","6","]",",","is_relative=True",")",">",">",">","fh","=","fh.to_absolute","(","cutoff=cutoff",")","#","doctest",":","+SKIP",">",">",">","#","ForecastingHorizon","(","[","'1960-07","'",",","...",",","'1960-12","'","]",",","is_relative=False",")","Automatically","casted","ForecastingHorizon","from","list","when","calling","predict","(",")",">",">",">","forecaster","=","NaiveForecaster","(","strategy=","''","drift","''",")",">",">",">","forecaster.fit","(","y_train",")","NaiveForecaster","(","...",")",">",">",">","y_pred","=","forecaster.predict","(","fh=","[","1,2,3","]",")",">",">",">","forecaster.fh","#","doctest",":","+SKIP",">",">",">","#","ForecastingHorizon","(","[","1",",","2",",","3","]",",","dtype='int64","'",",","is_relative=True",")","This","is","identical","to","give","an","object","of","ForecastingHorizon",">",">",">","y_pred","=","forecaster.predict","(","fh=ForecastingHorizon","(","[","1,2,3","]",")",")",">",">",">","forecaster.fh","#","doctest",":","+SKIP",">",">",">","#","ForecastingHorizon","(","[","1",",","2",",","3","]",",","dtype='int64","'",",","is_relative=True",")"]
docstr: Return zero-based indexer values for easy indexing into arrays.
  
  Parameters
  ----------
  cutoff : pd.Period, pd.Timestamp, int, optional (default=None)
      Cutoff value required to convert a relative forecasting
      horizon to an absolute one and vice versa.
  from_cutoff : bool, optional (default=True)
      - If True, zero-based relative to cutoff.
      - If False, zero-based relative to first value in forecasting
      horizon.
  
  Returns
  -------
  fh : pd.Index
      Indexer.
code: def to_indexer(self, cutoff=None, from_cutoff=True):
      """Return zero-based indexer values for easy indexing into arrays.
  
      Parameters
      ----------
      cutoff : pd.Period, pd.Timestamp, int, optional (default=None)
          Cutoff value required to convert a relative forecasting
          horizon to an absolute one and vice versa.
      from_cutoff : bool, optional (default=True)
          - If True, zero-based relative to cutoff.
          - If False, zero-based relative to first value in forecasting
          horizon.
  
      Returns
      -------
      fh : pd.Index
          Indexer.
      """
      if from_cutoff:
          relative_index = self.to_relative(cutoff).to_pandas()
          if is_integer_index(relative_index):
              return relative_index - 1
          else:
              # What does indexer mean if fh is timedelta?
              msg = (
                  "The indexer for timedelta-like forecasting horizon "
                  "is not yet implemented"
              )
              raise NotImplementedError(msg)
      else:
          relative = self.to_relative(cutoff)
          return relative - relative.to_pandas()[0]
  
imports: from functools import lru_cache
  from typing import Optional, Union
  import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  from sktime.utils.datetime import _coerce_duration_to_int
  from sktime.utils.validation import array_is_int, array_is_timedelta_or_date_offset, is_array, is_int, is_timedelta_or_date_offset
  from sktime.utils.validation._dependencies import _check_soft_dependencies
  from sktime.utils.validation.series import VALID_INDEX_TYPES, is_in_valid_absolute_index_types, is_in_valid_index_types, is_in_valid_relative_index_types, is_integer_index
label_desc: Use image node_id 20 for calling the ForecastingHorizon obj's underlying member method code with example usage: obj.to_indexer(cutoff, from_cutoff) and returns: unknown, unknown