<p dir="auto">Series.map works when passed a dict, but Index.map doesn't:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; s = pd.Series(['a', 'b', 'c', 'd'], index=['a', 'b', 'c', 'd'])
&gt;&gt;&gt; d = {'a': 0, 'b': 1, 'c': 2, 'd': 3}
&gt;&gt;&gt; s.map(d)
a    0
b    1
c    2
d    3
dtype: int64
&gt;&gt;&gt; s.index.map(d)
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/home/evanpw/Workspace/pandas/pandas/indexes/base.py&quot;, line 2305, in map
    return self._arrmap(self.values, mapper)
  File &quot;pandas/src/generated.pyx&quot;, line 2356, in pandas.algos.arrmap_object (pandas/algos.c:70221)
TypeError: 'dict' object is not callable"><pre lang=".python" class="notranslate"><code class="notranslate">&gt;&gt;&gt; s = pd.Series(['a', 'b', 'c', 'd'], index=['a', 'b', 'c', 'd'])
&gt;&gt;&gt; d = {'a': 0, 'b': 1, 'c': 2, 'd': 3}
&gt;&gt;&gt; s.map(d)
a    0
b    1
c    2
d    3
dtype: int64
&gt;&gt;&gt; s.index.map(d)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  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
</code></pre></div>
<p dir="auto">PR to follow shortly</p>
<p dir="auto">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.</p>
<h4 dir="auto">Code Sample:</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="df = pd.DataFrame({'col1': range(5)})
d = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four'}
df.col1.map(d) # perfectly valid
df.index.map(d) # TypeError: 'dict' object is not callable
s = pd.Series(d)
df.col1.map(s) # perfectly valid
df.index.map(s) # TypeError: 'Series' object is not callable"><pre class="notranslate"><span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">'col1'</span>: <span class="pl-en">range</span>(<span class="pl-c1">5</span>)})
<span class="pl-s1">d</span> <span class="pl-c1">=</span> {<span class="pl-c1">0</span>: <span class="pl-s">'zero'</span>, <span class="pl-c1">1</span>: <span class="pl-s">'one'</span>, <span class="pl-c1">2</span>: <span class="pl-s">'two'</span>, <span class="pl-c1">3</span>: <span class="pl-s">'three'</span>, <span class="pl-c1">4</span>: <span class="pl-s">'four'</span>}
<span class="pl-s1">df</span>.<span class="pl-s1">col1</span>.<span class="pl-en">map</span>(<span class="pl-s1">d</span>) <span class="pl-c"># perfectly valid</span>
<span class="pl-s1">df</span>.<span class="pl-s1">index</span>.<span class="pl-en">map</span>(<span class="pl-s1">d</span>) <span class="pl-c"># TypeError: 'dict' object is not callable</span>
<span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>(<span class="pl-s1">d</span>)
<span class="pl-s1">df</span>.<span class="pl-s1">col1</span>.<span class="pl-en">map</span>(<span class="pl-s1">s</span>) <span class="pl-c"># perfectly valid</span>
<span class="pl-s1">df</span>.<span class="pl-s1">index</span>.<span class="pl-en">map</span>(<span class="pl-s1">s</span>) <span class="pl-c"># TypeError: 'Series' object is not callable</span></pre></div>
<h4 dir="auto">Expected Output:</h4>
<p dir="auto">I would expect the same output for <code class="notranslate">df.col1.map(s)</code> and <code class="notranslate">df.index.map(s)</code>, 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.</p>
<h4 dir="auto">output of <code class="notranslate">pd.show_versions()</code>:</h4>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 2.7.6.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 3.16.0-67-generic<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: en_US.UTF-8<br>
LANG: en_DE.UTF-8</p>
<p dir="auto">pandas: 0.18.0<br>
nose: 1.3.7<br>
pip: 8.1.1<br>
setuptools: 20.6.6<br>
Cython: 0.23.5<br>
numpy: 1.11.0<br>
scipy: 0.17.0<br>
statsmodels: 0.6.1<br>
xarray: None<br>
IPython: 4.1.2<br>
sphinx: 1.4<br>
patsy: 0.4.1<br>
dateutil: 2.5.2<br>
pytz: 2016.3<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: 2.5.1<br>
matplotlib: 1.5.1<br>
openpyxl: 2.3.4<br>
xlrd: 0.9.4<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: 3.6.0<br>
bs4: None<br>
html5lib: 0.9999999<br>
httplib2: 0.9.2<br>
apiclient: None<br>
sqlalchemy: 1.0.12<br>
pymysql: None<br>
psycopg2: 2.6.1 (dt dec pq3 ext lo64)<br>
jinja2: 2.8<br>
boto: 2.39.0</p>