Displaying rows according to Specific Values
<p>I want to select several rows according to the attributes in Type column.</p>

<p>Let's pretend I have this dataframe:</p>

<pre><code>Type | Killed | Survive
Dog      1         0
Cat      3         5
Dog      4         1
Cow      2         4
Fish     1         3
</code></pre>

<p>I would like to select the row that has Type = ['Dog', 'Cat', 'Fish']</p>

<p>This would be my desire result:</p>

<pre><code>Type  | Killed | Survived
Dog       1         0
Dog       4         1
Cat       3         5
Fish      1         3
</code></pre>

<p>I know that you can use :</p>

<pre><code> df[df['Type'] == 'Dog']
</code></pre>

<p>to get dog only.</p>

<p>but I would like to know how to select more than one type.</p>

<p>I have tried this but it doesn't work:</p>

<pre><code>df[df['Type'] == 'Dog', 'Cat', 'Fish']
</code></pre>

<p>Thanks for helping me guys!</p>

<p>You can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.isin.html" rel="nofollow"><code>isin</code></a>:</p>

<pre><code>df[df['Type'].isin(['Dog', 'Cat', 'Fish'])]
</code></pre>

python pandas