## analyze()


Analyze a dataset using the specified method.


Usage


``` python
analyze(
    data,
    method="mean",
)
```


Computes summary statistics on the input data using the chosen aggregation method. The result includes the computed value and metadata about the analysis.


## Parameters


`data: list`  
A list of numeric values to analyze.

`method: str = ``"mean"`  
The aggregation method to use. One of `"mean"`, `"median"`, or `"sum"`. Defaults to `"mean"`.


## Returns


`dict`  
A dictionary with keys `"value"` (the computed result), `"method"` (the method used), and `"count"` (number of data points).


## Raises


`ValueError`  
If `data` is empty or `method` is not recognized.

`TypeError`  
If `data` contains non-numeric values.


## See Also

[transform()](transform.md#gdtest_numpy_rich.transform)  
Transform data before analysis.


## Notes

The mean is computed as the arithmetic mean. For large datasets, consider using chunked processing to avoid memory issues.

The implementation uses a simple single-pass algorithm:

.. math::

    \bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i


## Warnings

This function loads all data into memory. For datasets larger than available RAM, use a streaming approach instead.


## References

1.  <span style="font-weight: 600; color: #6c757d;">\[1\]</span> Knuth, D. "The Art of Computer Programming", Vol 2.
2.  <span style="font-weight: 600; color: #6c757d;">\[2\]</span> [https://en.wikipedia.org/wiki/Arithmetic_mean](https://en.wikipedia.org/wiki/Arithmetic_mean)


## Examples

``` python
>>> analyze([1, 2, 3, 4, 5])
```

{'value': 3.0, 'method': 'mean', 'count': 5}

``` python
>>> analyze([10, 20, 30], method="sum")
```

{'value': 60, 'method': 'sum', 'count': 3}
