MCPcopy
hub / github.com/dask/dask / pd_split

Function pd_split

dask/dataframe/dask_expr/_expr.py:1785–1794  ·  view source on GitHub ↗
(df, p, random_state=None, shuffle=False)

Source from the content-addressed store, hash-verified

1783
1784
1785def pd_split(df, p, random_state=None, shuffle=False):
1786 p = list(p)
1787 if shuffle:
1788 if not isinstance(random_state, np.random.RandomState):
1789 random_state = np.random.RandomState(random_state)
1790 df = df.sample(frac=1.0, random_state=random_state)
1791 index = pseudorandom(len(df), p, random_state)
1792 if df.ndim == 1:
1793 df = df.to_frame()
1794 return df.assign(_split=index)
1795
1796
1797class Split(Elemwise):

Callers

nothing calls this directly

Calls 5

pseudorandomFunction · 0.90
sampleMethod · 0.80
assignMethod · 0.80
RandomStateMethod · 0.45
to_frameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…