(df, p, random_state=None, shuffle=False)
| 1783 | |
| 1784 | |
| 1785 | def 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 | |
| 1797 | class Split(Elemwise): |
nothing calls this directly
no test coverage detected
searching dependent graphs…