code: def random_split(df, first_portion=.1):
      
      mask = np.random.binomial(1, first_portion, size=len(df)).astype(bool)
      return df[mask].copy(), df[~mask].copy()
docs: Randomly sample Dataframe rows. Typically for testset/training set cross-valication
  
      random_split(pd.DataFrame())