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>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package datascience
|
||||
|
||||
// GroupBy agrupa los elementos de un slice según la clave devuelta por keyFn.
|
||||
func GroupBy[T any, K comparable](xs []T, keyFn func(T) K) map[K][]T {
|
||||
groups := make(map[K][]T)
|
||||
for _, x := range xs {
|
||||
k := keyFn(x)
|
||||
groups[k] = append(groups[k], x)
|
||||
}
|
||||
return groups
|
||||
}
|
||||
Reference in New Issue
Block a user