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 createdf_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 toalignment
in a way that 0 translates intoalignment[segment]
timestamp and any other values are calculated based onfreq
.- 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:
pandas offset aliases for datetime timestamp
None for integer timestamp
timestamp_name (str) – Name of created timestamp column.
- Returns:
Dataframe with a created timestamp in a long format.