Is there a more pythonic way to write this?
<p>I'm looking to make this a little more pythonic.</p>

<pre><code>user_df[-1:]['status_id'].values[0] in {3,5}
</code></pre>

<p>I ititially tried <code>user_id.ix[-1:, 'status_id'].isin([3,5])</code>, but didn't work.</p>

<p>Any suggestions? The top version works, but looks a little weird.</p>

<p>You can try:</p>

<pre><code>user_id['status_id'].iloc[-1:].isin([3,5])
</code></pre>

<p>Sample:</p>

<pre><code>user_id = pd.DataFrame({'status_id':[1,2,3]})
print (user_id)
   status_id
0          1
1          2
2          3

#iloc without : [-1] return scalar
print (user_id['status_id'].iloc[-1] in set({3,5}))
True

#iloc with : [-1:] return vector - Series
print (user_id['status_id'].iloc[-1:].isin([3,5]))
2    True
Name: status_id, dtype: bool
</code></pre>

python pandas