Sample each group after pandas groupby
<p>I know this must have been answered some where but I just could not find it.</p>

<p><strong>Problem</strong>: Sample each group after groupby operation.</p>

<pre class="lang-py prettyprint-override"><code>import pandas as pd

df = pd.DataFrame({'a': [1,2,3,4,5,6,7],
                   'b': [1,1,1,0,0,0,0]})

grouped = df.groupby('b')

# now sample from each group, e.g., I want 30% of each group
</code></pre>