pandas.Series.get fails with: object has no attribute 'values'
<p>I don't seem to be able to call Series.get on a Series object. </p>

<pre><code>&gt;&gt; print col
0    1
1    1
2    0
Name: a, dtype: float64
&gt;&gt;&gt; counts = col.value_counts()
&gt;&gt;&gt; print counts
1    2
0    1
dtype: int64
</code></pre>

<p>... makes sense. 2 ones. 1 zero</p>

<pre><code>&gt;&gt;&gt; print type(counts)
&lt;class 'pandas.core.series.Series'&gt;
</code></pre>

<p>... OK. The result is a Series. How can I read out the elements? According to <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.get.html#pandas.Series.get" rel="nofollow">Series.get</a>, and the docstring for counts.get, I should be able to:</p>

<pre><code>zeros = counts.get(0,0)
ones = counts.get(1,0)
</code></pre>

<p>... but this fails with:</p>

<pre><code>AttributeError: 'numpy.ndarray' object has no attribute 'values'
</code></pre>

<p>What I have misunderstood?</p>

<pre><code>&gt;&gt;&gt; help(counts.get)
Help on method get in module pandas.core.series:

get(self, label, default=None) method of pandas.core.series.Series instance
    Returns value occupying requested label, default to specified
    missing value if not present. Analogous to dict.get

    Parameters
    ----------
    label : object
        Label value looking for
    default : object, optional
        Value to return if label not in index

    Returns
    -------
    y : scalar
</code></pre>

<p>In:</p>

<pre><code>&gt;&gt;&gt; print counts
1    2
0    1
</code></pre>

<p>aren't 1 and 0 the labels?</p>

<p>Seems to be bug in pandas 15</p>

<p>Upgrading to pandas 18 resolves this.</p>

python pandas