etna.datasets.infer_alignment#

infer_alignment(df: DataFrame) Dict[str, Timestamp] | Dict[str, int][source]#

Inference alignment of a given dataframe.

Alignment tells us which timestamps for each segment should be considered to have the same integer timestamp after alignment transformation.

For long dataframe the alignment is determined by the last timestamp for each segment. Last timestamp is taken without checking is ‘target’ value missing or not.

Parameters:

df (DataFrame) – Dataframe in a long format.

Returns:

Dictionary with mapping segment -> timestamp.

Raises:

ValueError: – Parameter df isn’t in a long format.

Return type:

Dict[str, Timestamp] | Dict[str, int]