> ## Documentation Index
> Fetch the complete documentation index at: https://nixtla-old-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Utilies for generating time series datasets

# Data

***

<a href="https://github.com/Nixtla/utilsforecast/blob/main/utilsforecast/data.py#L49" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### generate\_series

> ```text theme={null}
>  generate_series (n_series:int, freq:str='D', min_length:int=50,
>                   max_length:int=500, n_static_features:int=0,
>                   equal_ends:bool=False, with_trend:bool=False,
>                   static_as_categorical:bool=True, n_models:int=0,
>                   level:Optional[List[float]]=None,
>                   engine:Literal['pandas','polars']='pandas', seed:int=0)
> ```

*Generate Synthetic Panel Series.*

|                         | **Type**  | **Default** | **Details**                                                                                             |
| ----------------------- | --------- | ----------- | ------------------------------------------------------------------------------------------------------- |
| n\_series               | int       |             | Number of series for synthetic panel.                                                                   |
| freq                    | str       | D           | Frequency of the data (pandas alias).<br />Seasonalities are implemented for hourly, daily and monthly. |
| min\_length             | int       | 50          | Minimum length of synthetic panel’s series.                                                             |
| max\_length             | int       | 500         | Maximum length of synthetic panel’s series.                                                             |
| n\_static\_features     | int       | 0           | Number of static exogenous variables for synthetic panel’s series.                                      |
| equal\_ends             | bool      | False       | Series should end in the same timestamp.                                                                |
| with\_trend             | bool      | False       | Series should have a (positive) trend.                                                                  |
| static\_as\_categorical | bool      | True        | Static features should have a categorical data type.                                                    |
| n\_models               | int       | 0           | Number of models predictions to simulate.                                                               |
| level                   | Optional  | None        | Confidence level for intervals to simulate for each model.                                              |
| engine                  | Literal   | pandas      | Output Dataframe type.                                                                                  |
| seed                    | int       | 0           | Random seed used for generating the data.                                                               |
| **Returns**             | **Union** |             | **Synthetic panel with columns \[`unique_id`, `ds`, `y`] and exogenous features.**                      |

```python theme={null}
synthetic_panel = generate_series(n_series=2)
synthetic_panel.groupby('unique_id', observed=True).head(4)
```

|     | unique\_id | ds         | y        |
| --- | ---------- | ---------- | -------- |
| 0   | 0          | 2000-01-01 | 0.357595 |
| 1   | 0          | 2000-01-02 | 1.301382 |
| 2   | 0          | 2000-01-03 | 2.272442 |
| 3   | 0          | 2000-01-04 | 3.211827 |
| 222 | 1          | 2000-01-01 | 5.399023 |
| 223 | 1          | 2000-01-02 | 6.092818 |
| 224 | 1          | 2000-01-03 | 0.476396 |
| 225 | 1          | 2000-01-04 | 1.343744 |
