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

# Expanding

> Compute expanding mean, std, min, max, and quantile

##

### `expanding_mean`

```python theme={null}
expanding_mean(x, skipna=False)
```

Compute the expanding\_mean of the input array.

**Parameters:**

| Name     | Type                    | Description                                                                                                                                                                                                                | Default    |
| -------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `x`      | <code>np.ndarray</code> | Input array.                                                                                                                                                                                                               | *required* |
| `skipna` | <code>bool</code>       | If True, exclude NaN values from calculations. When False (default), any NaN value causes the result to be NaN, maintaining backwards compatibility. When True, NaN values are ignored (matching pandas default behavior). | *required* |

**Returns:**

| Type                                           | Description |
| ---------------------------------------------- | ----------- |
| np.ndarray: Array with the expanding statistic |             |

**Examples:**

```pycon theme={null}
>>> import numpy as np
>>> x = np.array([1.0, 2.0, np.nan, 4.0, 5.0])
>>> # Default behavior: NaN propagates
>>> expanding_mean(x)
array([1., 1.5, nan, nan, nan])
>>> # With skipna=True: NaN values are excluded
>>> expanding_mean(x, skipna=True)
array([1., 1.5, 1.5, 2.33..., 3.0])
```

### `expanding_std`

```python theme={null}
expanding_std(x, skipna=False)
```

Compute the expanding\_std of the input array.

**Parameters:**

| Name     | Type                    | Description                                                                                                                                                                                                                | Default    |
| -------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `x`      | <code>np.ndarray</code> | Input array.                                                                                                                                                                                                               | *required* |
| `skipna` | <code>bool</code>       | If True, exclude NaN values from calculations. When False (default), any NaN value causes the result to be NaN, maintaining backwards compatibility. When True, NaN values are ignored (matching pandas default behavior). | *required* |

**Returns:**

| Type                                           | Description |
| ---------------------------------------------- | ----------- |
| np.ndarray: Array with the expanding statistic |             |

**Examples:**

```pycon theme={null}
>>> import numpy as np
>>> x = np.array([1.0, 2.0, np.nan, 4.0, 5.0])
>>> # Default behavior: NaN propagates
>>> expanding_std(x)
array([1., 1.5, nan, nan, nan])
>>> # With skipna=True: NaN values are excluded
>>> expanding_std(x, skipna=True)
array([1., 1.5, 1.5, 2.33..., 3.0])
```

### `expanding_min`

```python theme={null}
expanding_min(x, skipna=False)
```

Compute the expanding\_min of the input array.

**Parameters:**

| Name     | Type                    | Description                                                                                                                                                                                                                | Default    |
| -------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `x`      | <code>np.ndarray</code> | Input array.                                                                                                                                                                                                               | *required* |
| `skipna` | <code>bool</code>       | If True, exclude NaN values from calculations. When False (default), any NaN value causes the result to be NaN, maintaining backwards compatibility. When True, NaN values are ignored (matching pandas default behavior). | *required* |

**Returns:**

| Type                                           | Description |
| ---------------------------------------------- | ----------- |
| np.ndarray: Array with the expanding statistic |             |

**Examples:**

```pycon theme={null}
>>> import numpy as np
>>> x = np.array([1.0, 2.0, np.nan, 4.0, 5.0])
>>> # Default behavior: NaN propagates
>>> expanding_min(x)
array([1., 1.5, nan, nan, nan])
>>> # With skipna=True: NaN values are excluded
>>> expanding_min(x, skipna=True)
array([1., 1.5, 1.5, 2.33..., 3.0])
```

### `expanding_max`

```python theme={null}
expanding_max(x, skipna=False)
```

Compute the expanding\_max of the input array.

**Parameters:**

| Name     | Type                    | Description                                                                                                                                                                                                                | Default    |
| -------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `x`      | <code>np.ndarray</code> | Input array.                                                                                                                                                                                                               | *required* |
| `skipna` | <code>bool</code>       | If True, exclude NaN values from calculations. When False (default), any NaN value causes the result to be NaN, maintaining backwards compatibility. When True, NaN values are ignored (matching pandas default behavior). | *required* |

**Returns:**

| Type                                           | Description |
| ---------------------------------------------- | ----------- |
| np.ndarray: Array with the expanding statistic |             |

**Examples:**

```pycon theme={null}
>>> import numpy as np
>>> x = np.array([1.0, 2.0, np.nan, 4.0, 5.0])
>>> # Default behavior: NaN propagates
>>> expanding_max(x)
array([1., 1.5, nan, nan, nan])
>>> # With skipna=True: NaN values are excluded
>>> expanding_max(x, skipna=True)
array([1., 1.5, 1.5, 2.33..., 3.0])
```

### `expanding_quantile`

```python theme={null}
expanding_quantile(x, p, skipna=False)
```

Compute the expanding\_quantile of the input array.

**Parameters:**

| Name     | Type                                   | Description                                                                                                                                                                                                                | Default            |
| -------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| `x`      | <code>[ndarray](#numpy.ndarray)</code> | Input array.                                                                                                                                                                                                               | *required*         |
| `p`      | <code>[float](#float)</code>           | Quantile to compute.                                                                                                                                                                                                       | *required*         |
| `skipna` | <code>[bool](#bool)</code>             | If True, exclude NaN values from calculations. When False (default), any NaN value causes the result to be NaN, maintaining backwards compatibility. When True, NaN values are ignored (matching pandas default behavior). | <code>False</code> |

**Returns:**

| Type                                   | Description                                    |
| -------------------------------------- | ---------------------------------------------- |
| <code>[ndarray](#numpy.ndarray)</code> | np.ndarray: Array with the expanding statistic |

**Examples:**

```pycon theme={null}
>>> import numpy as np
>>> x = np.array([1.0, 2.0, np.nan, 4.0, 5.0])
>>> # Default behavior: NaN propagates
>>> expanding_quantile(x, 0.5)
array([1., 1.5, nan, nan, nan])
>>> # With skipna=True: NaN values are excluded
>>> expanding_quantile(x, 0.5, skipna=True)
array([1., 1.5, 1.5, 2., 2.5])
```
