title: Randomly sampling Pandas dataframe based on distribution of column
body: <p>Say I have a very large dataframe, which I want to sample to match the distribution of a column of the dataframe as closely as possible (in this case, the 'bias' column).</p>
  
  <p>I run:</p>
  
  <pre><code>train['bias'].value_counts(normalize=True)
  </code></pre>
  
  <p>and see:</p>
  
  <pre><code>least           0.277220
  left            0.250000
  right           0.250000
  left-center     0.141244
  right-center    0.081536
  </code></pre>
  
  <p>If I want to take a sample of the train dataframe where the distribution of the sample's 'bias' column matches this distribution, what would be the best way to go about it?</p>