DataFrame indices can't map through dictionaries or series #12756
Labels
API Design
Clean
Internals
Related to non-user accessible pandas implementation
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
Milestone
A DataFrame index has the map function, which expects a mapper. However, unlike mapping a Series, it only accepts callables, and won't work when mapping through dictionaries or series.
Code Sample:
Expected Output:
I would expect the same output for
df.col1.map(s)
anddf.index.map(s)
, or at least that it returns an nparray with the mapped values, as it does when we do pass a callable, but not that it breaks like it does.output of
pd.show_versions()
:INSTALLED VERSIONS
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.16.0-67-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_DE.UTF-8
pandas: 0.18.0
nose: 1.3.7
pip: 8.1.1
setuptools: 20.6.6
Cython: 0.23.5
numpy: 1.11.0
scipy: 0.17.0
statsmodels: 0.6.1
xarray: None
IPython: 4.1.2
sphinx: 1.4
patsy: 0.4.1
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: None
tables: None
numexpr: 2.5.1
matplotlib: 1.5.1
openpyxl: 2.3.4
xlrd: 0.9.4
xlwt: None
xlsxwriter: None
lxml: 3.6.0
bs4: None
html5lib: 0.9999999
httplib2: 0.9.2
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: 2.39.0
The text was updated successfully, but these errors were encountered: