8000 Bug in series.get? · Issue #6383 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Bug in series.get? #6383

New issue
8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jseabold opened this issue Feb 17, 2014 · 1 comment · Fixed by #6385
Closed

Bug in series.get? #6383

jseabold opened this issue Feb 17, 2014 · 1 comment · Fixed by #6385
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@jseabold
Copy link
Contributor

This showed up in the test suite for a PR for statsmodels. I have very little idea where this Series came from or why it's using get like this, but here it is anyway.

df = pd.Series(np.array([43, 48, 60, 48, 50, 51, 50, 45, 57, 48, 56, 
                        45, 51, 39, 55, 43, 54, 52, 51, 54]), 
                  index=pd.Float64Index([25.0, 36.0, 49.0, 64.0, 81.0, 100.0, 
                                  121.0, 144.0, 169.0, 196.0, 1225.0, 
                                  1296.0, 1369.0, 1444.0, 1521.0, 1600.0,
                                  1681.0, 1764.0, 1849.0, 1936.0], 
                                  dtype='object'))
df.get(25, 0)

Traceback:

----> 1 df.get(25, 0)

/home/skipper/src/pandas-skipper/pandas/core/series.pyc in get(self, label, default)
    756         """
    757         try:
--> 758             return self.get_value(label)
    759         except KeyError:
    760             return default

/home/skipper/src/pandas-skipper/pandas/core/series.pyc in get_value(self, label)
    776         value : scalar value
    777         """
--> 778         return self.index.get_value(self.values, label)
    779 
    780     def set_value(self, label, value):

/home/skipper/src/pandas-skipper/pandas/core/index.pyc in get_value(self, series, key)
1821         k = _values_from_object(key)
1822         loc = self.get_loc(k)
-> 1823         new_values = series.values[loc]
1824         if np.isscalar(new_values):
1825             return new_values

AttributeError: 'numpy.ndarray' object has no attribute 'values'

Version

[~/]
[11]: pd.version.version
[11]: '0.13.1-105-g8119991'
@jreback
Copy link
Contributor
jreback commented Feb 17, 2014

was using an older method (pre 0.13), which wasn't necessary...thanks for the report
(and of course no tests for get!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0