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>You could slice the <code>tuple</code> by using <code>apply</code>:</p>

<pre><code>df[df['Value'].apply(lambda x: x[1] &lt;= 2)]
</code></pre>

<p><a href="http://i.stack.imgur.com/MZBwY.png" rel="nofollow"><img src="http://i.stack.imgur.com/MZBwY.png" alt="Image"></a></p>

<hr>

<p>Seems, it was a list of tuples and not a <code>DF</code>:</p>

<p>To return a <code>list</code> back:</p>

<pre><code>data = [item for item in [(1,2,3), (2,5,4), (3,3,3)] if item[1] &lt;= 2]
# [(1, 2, 3)]
</code></pre>

<p>To return a <code>series</code> instead:</p>

<pre><code>pd.Series(data)
#0    (1, 2, 3)
#dtype: object
</code></pre>

python pandas tuples