Files
fn_registry/python/functions/datascience/histogram.md
T
egutierrez 988e901066 docs: params/output semántico en 506 funciones para composabilidad
Añade campos params y output al frontmatter YAML de las 506 funciones del registry.
Cada parámetro tiene descripción semántica (qué representa, unidades, rango típico)
y cada función describe qué produce su output. Permite a agentes razonar sobre
cadenas de composición (ej: prices → log_return → sharpe_ratio) sin leer código.
2026-04-05 18:45:16 +02:00

39 lines
1.0 KiB
Markdown

---
name: histogram
kind: function
lang: py
domain: datascience
version: "1.0.0"
purity: pure
signature: "def histogram(data: list, buckets: int) -> list"
description: "Calcula histograma con N buckets. Retorna lista de conteos por bucket."
tags: [statistics, histogram, python]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: []
params:
- name: data
desc: "lista de valores numericos para agrupar en buckets"
- name: buckets
desc: "numero de buckets a crear (ej: 5, 10, 100). Mayor = histograma mas detallado."
output: "lista de conteos con len(resultado) == buckets, cada elemento es el numero de valores en ese bucket"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/datascience/datascience.py"
---
## Ejemplo
```python
histogram([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5)
# [2, 2, 2, 2, 2]
```
## Notas
Los buckets cubren el rango [min, max] uniformemente. El ultimo bucket incluye el valor maximo. Si todos los valores son iguales, todos caen en el primer bucket.