Create a set from a series in pandas
<p>I have a dataframe extracted from Kaggle's San Fransico Salaries: <a href="https://www.kaggle.com/kaggle/sf-salaries" rel="nofollow">https://www.kaggle.com/kaggle/sf-salaries</a>
and I wish to create a set of the values of a column, for instance 'Status'.</p>

<p>This is what I have tried but it brings a list of all the records instead of the set (sf is how I name the data frame).</p>

<pre><code>a=set(sf['Status'])
print a
</code></pre>

<p>According to this webpage, this should work.
<a href="http://stackoverflow.com/questions/15768757/how-to-construct-a-set-out-of-list-items">How to construct a set out of list items?</a></p>

<p>If you only need to get list of unique values, you can just use <code>unique</code> method.
If you want to have Python's set, then do <code>set(some_series)</code></p>

<pre><code>In [1]: s = pd.Series([1, 2, 3, 1, 1, 4])

In [2]: s.unique()
Out[2]: array([1, 2, 3, 4])

In [3]: set(s)
Out[3]: {1, 2, 3, 4}
</code></pre>

<p>However, if you have DataFrame, just select series out of it ( <code>some_data_frame['&lt;col_name&gt;']</code> ).</p>

python pandas dataframe series