selecting rows in a tuplelist in pandas
<p>I have a list of tuples as below in python:</p>

<pre><code>   Index        Value
     0         (1,2,3)
     1         (2,5,4)
     2         (3,3,3)
</code></pre>

<p>How can I select rows from this in which the second value is less than or equal 2?</p>

<p><strong><em>EDIT:</em></strong></p>

<p>Basically, the data is in the form of <code>[(1,2,3), (2,5,4), (3,3,3)....]</code></p>

<p>just to put this out there.  you should read <a href="http://stackoverflow.com/help/mcve">mcve</a>.  your question was/is confusing because it looks as though you've got 2 good answers and your not satisfied.  then you edited your question to be clearer, but just barely.</p>

<p>ok, now that i've got my editorial out of the way.</p>

<hr>

<p><strong><em>setup</em></strong><br>
this is what i'm assuming i'm working with</p>

<pre><code># list of tuples
lot = [(1, 2, 3), (2, 5, 4), (3, 3, 3)]
</code></pre>

<p><strong><em>desired output</em></strong><br>
i think.  btw, nothing to do with pandas at all</p>

<pre><code>[(a, b, c) for a, b, c in lot if b &lt;= 2]

[(1, 2, 3)]
</code></pre>

<p><strong><em>with pandas</em></strong><br>
however, since you did tag this pandas</p>

<pre><code>s = pd.Series(lot)
</code></pre>

<p>@TrigonaMinima's answer, give them credit if this works for you.</p>

<pre><code>s[s.str[1].le(2)]

0    (1, 2, 3)
dtype: object
</code></pre>

python pandas tuples