Python Pandas_How to select data after using drop_duplicates()?
<p>I am learning python pandas to processing data. </p>

<ol>
<li>I firstly using <code>drop_duplicates()</code> method to treat <code>db_new</code> and get <code>a</code>;</li>
<li>Then I'd like to find what kind of data in a using <code>print</code>;</li>
<li>I try to find if a data is in a using <code>for...in</code>, but I found that even the data in a can not be find in it, why?</li>
</ol>

<p><a href="http://i.stack.imgur.com/Z60lq.png" rel="nofollow"><img src="http://i.stack.imgur.com/Z60lq.png" alt="I found 9 is not in a"></a></p>

<pre><code>a = db_new.iloc[:i,4:5].drop_duplicates()
print a
for x in a:
    print x**
</code></pre>

<ol start="4">
<li>I try to use <code>for in</code> to find what can get in a. I only get <code>E</code>, which is the column index. Do you know why this happen?</li>
</ol>

<p>Here <code>a</code> is a dataframe, so when you iterate over <code>a</code> you iterate over column names, hence the result, <code>E</code>.</p>

<p>If you want to iterate over values, you need to make <code>a</code> a series, which you can do using <code>squeeze</code>:</p>

<pre><code>for x in a.squeeze():
    print x
</code></pre>

python pandas