etna.datasets.make_timestamp_df_from_alignment#

make_timestamp_df_from_alignment(alignment: Dict[str, Timestamp] | Dict[str, int], start: int | None = None, end: int | None = None, periods: int | None = None, freq: str | None = None, timestamp_name: str = 'external_timestamp')[source]#

Create a dataframe with timestamp according to a given alignment.

This utility could be used after alignment of df to create df_exog with external timestamps extended into the future.

For each segment we take start, end, periods and create sequential integer timestamps. After that we map this sequential integer timestamps into external timestamps according to alignment in a way that 0 translates into alignment[segment] timestamp and any other values are calculated based on freq.

Parameters:
  • alignment (Dict[str, Timestamp] | Dict[str, int]) – Alignment to use.

  • start (int | None) – Start timestamp to generate sequential integer timestamps.

  • end (int | None) – End timestamp to generate sequential integer timestamps.

  • periods (int | None) – Number of periods to generate sequential integer timestamps.

  • freq (str | None) –

    Frequency of timestamps to generate, possible values:

  • timestamp_name (str) – Name of created timestamp column.

Returns:

Dataframe with a created timestamp in a long format.