pandas unique values multiple columns different dtypes
<p>Similar to <a href="http://stackoverflow.com/questions/26977076/pandas-unique-values-multiple-columns">pandas unique values multiple columns</a> I want to count the number of unique values per column. However, as the dtypes differ I get the following error:
<a href="http://i.stack.imgur.com/78Fd5.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/78Fd5.jpg" alt="enter image description here"></a></p>

<p>The data frame looks like
<a href="http://i.stack.imgur.com/8NF69.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/8NF69.jpg" alt="enter image description here"></a>
A <code>small[['TARGET', 'title']].apply(pd.Series.describe)</code> gives me the result, but only for the category types and I am unsure how to filter the index for only the last row with the unique values per column</p>

<p>Use <code>apply</code> and <code>np.unique</code> to grab the unique values in each column and take its <code>size</code>:</p>

<pre><code>small[['TARGET','title']].apply(lambda x: np.unique(x).size)
</code></pre>

<p>Thanks!</p>

python pandas unique