Skip to content
New issue

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

Index.map should allow dict as argument #13517

Closed
evanpw opened this issue Jun 26, 2016 · 2 comments
Closed

Index.map should allow dict as argument #13517

evanpw opened this issue Jun 26, 2016 · 2 comments
Labels
Dtype Conversions Unexpected or buggy dtype conversions Duplicate Report Duplicate issue or pull request Enhancement Index Related to the Index class or subclasses

Comments

@evanpw
Copy link
Contributor

evanpw commented Jun 26, 2016

Series.map works when passed a dict, but Index.map doesn't:

>>> s = pd.Series(['a', 'b', 'c', 'd'], index=['a', 'b', 'c', 'd'])
>>> d = {'a': 0, 'b': 1, 'c': 2, 'd': 3}
>>> s.map(d)
a    0
b    1
c    2
d    3
dtype: int64
>>> s.index.map(d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/evanpw/Workspace/pandas/pandas/indexes/base.py", line 2305, in map
    return self._arrmap(self.values, mapper)
  File "pandas/src/generated.pyx", line 2356, in pandas.algos.arrmap_object (pandas/algos.c:70221)
TypeError: 'dict' object is not callable

PR to follow shortly

@jreback
Copy link
Contributor

jreback commented Jun 26, 2016

xref #12776 (though its orthogonal to this change)

@jreback jreback added Enhancement Indexing Related to indexing on series/frames, not to indexes themselves Dtype Conversions Unexpected or buggy dtype conversions labels Jun 26, 2016
@toobaz toobaz added Index Related to the Index class or subclasses Duplicate Report Duplicate issue or pull request and removed Indexing Related to indexing on series/frames, not to indexes themselves labels Jun 28, 2019
@toobaz
Copy link
Member

toobaz commented Jun 28, 2019

Closed in #13518 (was duplicated of #12756 )

@toobaz toobaz closed this as completed Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Duplicate Report Duplicate issue or pull request Enhancement Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants