Pandas random sample with remove
<p>I'm aware of <code>DataFrame.sample()</code>, but how can I do this and also remove the sample from the dataset? (<em>Note: AFAIK this has nothing to do with sampling with replacement</em>)</p>

<p>For example here is <strong>the essence</strong> of what I want to achieve, this does not actually work:</p>

<pre><code>len(df) # 1000

df_subset = df.sample(300)
len(df_subset) # 300

df = df.remove(df_subset)
len(df) # 700
</code></pre>

<p>pandas <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.sample.html" rel="nofollow">random sample</a> : </p>

<pre><code>train=df.sample(frac=0.8,random_state=200)
test=df.drop(train.index)
</code></pre>

python pandas