Helper to create test context DataFrames.
(series_ids=["A", "B"], n_points=[10, 10], target_cols=["target"], covariates=None, freq="h")
| 15 | |
| 16 | |
| 17 | def create_df(series_ids=["A", "B"], n_points=[10, 10], target_cols=["target"], covariates=None, freq="h"): |
| 18 | """Helper to create test context DataFrames.""" |
| 19 | series_dfs = [] |
| 20 | for series_id, length in zip(series_ids, n_points): |
| 21 | series_data = {"item_id": series_id, "timestamp": pd.date_range(end="2001-10-01", periods=length, freq=freq)} |
| 22 | for target_col in target_cols: |
| 23 | series_data[target_col] = np.random.randn(length) |
| 24 | if covariates: |
| 25 | for cov in covariates: |
| 26 | series_data[cov] = np.random.randn(length) |
| 27 | series_dfs.append(pd.DataFrame(series_data)) |
| 28 | return pd.concat(series_dfs, ignore_index=True) |
| 29 | |
| 30 | |
| 31 | def create_future_df(forecast_start_times: list, series_ids=["A", "B"], n_points=[5, 5], covariates=None, freq="h"): |
no outgoing calls