(df, p, random_state=None, shuffle=False)
| 1780 | |
| 1781 | |
| 1782 | def pd_split(df, p, random_state=None, shuffle=False): |
| 1783 | p = list(p) |
| 1784 | if shuffle: |
| 1785 | if not isinstance(random_state, np.random.RandomState): |
| 1786 | random_state = np.random.RandomState(random_state) |
| 1787 | df = df.sample(frac=1.0, random_state=random_state) |
| 1788 | index = pseudorandom(len(df), p, random_state) |
| 1789 | if df.ndim == 1: |
| 1790 | df = df.to_frame() |
| 1791 | return df.assign(_split=index) |
| 1792 | |
| 1793 | |
| 1794 | class Split(Elemwise): |
nothing calls this directly
no test coverage detected