title: Splittng dataframe into train/test based on column value
body: <p>dataframe I want to use for ML training has N feature columns, 1 label column and a few columns that specify which rows belong to same session.  In order to avoid train-test leakage, I want all rows from a session to be entirely in the test set or in the training set.</p>
  <p>I tried <code>test = df[df['sess_id'] % 4 == 0]</code> and <code>train = df[df['sess_id'] % 4 != 0]</code>, but looks like <code>sess_id</code> takes only odd values and <code>df[df['sess_id'] % 4 == 0]</code> is always empty.</p>
  <p>Is there a straightforward to achieve what I want that will give 75-25 split regardless of the actual values in the <code>sess_id</code> column?</p>