Files
fn_registry/functions/datascience/clip.go
egutierrez fc734029c1 feat: 15 funciones datascience — estadística, DSP e IO de datos
12 funciones puras con implementación real:
Standardize, MinMaxScale, Clip, RollingWindow, ZipSlices, GroupBy,
Histogram, Pearson, Autocorrelation, FFT (Cooley-Tukey), DetectOutliers, Impute

3 funciones impuras (stubs):
LoadCSV, LoadParquet, FetchDataFrame

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 02:23:36 +01:00

18 lines
355 B
Go

package datascience
// Clip recorta cada valor del slice para que quede dentro del rango [min, max].
func Clip(data []float64, min, max float64) []float64 {
result := make([]float64, len(data))
for i, v := range data {
switch {
case v < min:
result[i] = min
case v > max:
result[i] = max
default:
result[i] = v
}
}
return result
}