Skip to main content

id_time_grid

id_time_grid(
    df, freq, start="per_serie", end="global", id_col="unique_id", time_col="ds"
)
Generate all expected combiations of ids and times. Parameters:
NameTypeDescriptionDefault
dfpandas or polars DataFrameInput datarequired
freqstr or intSeries’ frequencyrequired
start(str, int, date or datetime)Initial timestamp for the series. * ‘per_serie’ uses each serie’s first timestamp * ‘global’ uses the first timestamp seen in the data * Can also be a specific timestamp or integer, e.g. ‘2000-01-01’, 2000 or datetime(2000, 1, 1) Defaults to “per_serie”.‘per_serie’
end(str, int, date or datetime)Initial timestamp for the series. * ‘per_serie’ uses each serie’s last timestamp * ‘global’ uses the last timestamp seen in the data * Can also be a specific timestamp or integer, e.g. ‘2000-01-01’, 2000 or datetime(2000, 1, 1) Defaults to “global”.‘global’
id_colstrColumn that identifies each serie. Defaults to ‘unique_id’.‘unique_id’
time_colstrColumn that identifies each timestamp. Defaults to ‘ds’.‘ds’
Returns:
TypeDescription
DFTypepandas or polars DataFrame: Dataframe with expected ids and times.

fill_gaps

fill_gaps(
    df, freq, start="per_serie", end="global", id_col="unique_id", time_col="ds"
)
Enforce start and end datetimes for dataframe. Parameters:
NameTypeDescriptionDefault
dfpandas or polars DataFrameInput datarequired
freqstr or intSeries’ frequencyrequired
start(str, int, date or datetime)Initial timestamp for the series. * ‘per_serie’ uses each serie’s first timestamp * ‘global’ uses the first timestamp seen in the data * Can also be a specific timestamp or integer, e.g. ‘2000-01-01’, 2000 or datetime(2000, 1, 1) Defaults to “per_serie”.‘per_serie’
end(str, int, date or datetime)Initial timestamp for the series. * ‘per_serie’ uses each serie’s last timestamp * ‘global’ uses the last timestamp seen in the data * Can also be a specific timestamp or integer, e.g. ‘2000-01-01’, 2000 or datetime(2000, 1, 1) Defaults to “global”.‘global’
id_colstrColumn that identifies each serie. Defaults to ‘unique_id’.‘unique_id’
time_colstrColumn that identifies each timestamp. Defaults to ‘ds’.‘ds’
Returns:
TypeDescription
DFTypepandas or polars DataFrame: Dataframe with gaps filled.