title: Undesired results when using .sample() with .where() in Python
body: <p>I'm trying to select 2 random values from a dataframe where a condition is met.
  Please ee example df below:</p>
  <pre><code>data = {'col1':  ['abc', 'def','ghi','jkl','mno','pqr','stu','vwx','yz'],
          'col2': ['4', '1','4','4','0','1','4','2','4'],
          'col3': ['Sweden', 'Malaysia','Sweden','Venezuela','France','Sweden','Australia','Belgium','Sweden']
          }
  
  df = pd.DataFrame (data, columns = ['col1','col2','col3'])
  </code></pre>
  <p>I want to select 2 random values from 'col1' where 'col2' is equal to 4. The code I then use is:</p>
  <pre><code>print(df['col1'].sample(n=2).where(df['col2']==4))
  </code></pre>
  <p>With the desired output being:</p>
  <pre><code>0  abc
  6  stu
  </code></pre>
  <p>....or</p>
  <pre><code>8  yz
  2 ghi 
  </code></pre>
  <p>However the code currently gives outputs such as:</p>
  <pre><code>7    NaN
  3    NaN
  </code></pre>
  <p>This is undesirable in that a) I'm expecting to see a string value as text and b) whilst the value correspoding to row 3 would meet the criteria, the value corresponding to row 7 does not, so the criteria is not being met in all cases.</p>
  <p><strong>QUESTIONS:</strong></p>
  <ol>
  <li>How would I modify my code such that it returns text values and only in the case where the condition is met</li>
  <li>How would I add a second condition eg <code>.where(df['col2']==4) &amp; (df['col3']=='Sweden')</code></li>
  </ol>
  <p>Grateful for any guidance here.</p>