MCPcopy
hub / github.com/ray-project/ray / normalize

Function normalize

python/ray/data/tests/test_groupby_e2e.py:1043–1049  ·  view source on GitHub ↗
(at: pa.Table)

Source from the content-addressed store, hash-verified

1041
1042 # Normalize the numeric columns (i.e. B and C) for each group.
1043 def normalize(at: pa.Table):
1044 r = at.select("A")
1045 sb = pa.compute.sum(at.column("B")).cast(pa.float64())
1046 r = r.append_column("B", pa.compute.divide(at.column("B"), sb))
1047 sc = pa.compute.sum(at.column("C")).cast(pa.float64())
1048 r = r.append_column("C", pa.compute.divide(at.column("C"), sc))
1049 return r
1050
1051 mapped = grouped.map_groups(normalize, batch_format="pyarrow")
1052

Callers

nothing calls this directly

Calls 4

divideMethod · 0.80
selectMethod · 0.45
castMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…