<p dir="auto">This is related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="145213976" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/12766" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/12766/hovercard" href="https://github.com/pandas-dev/pandas/issues/12766">#12766</a><br>
Possibly a duplicate.</p>
<h4 dir="auto">A small, complete example of the issue</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="DD = pd.DataFrame({'A':[1,2,3,4,5]})
DD.index.name = 'Test'
print DD.index.name
DD.index = DD.index.map(unicode)
print DD.index.name"><pre class="notranslate"><code class="notranslate">DD = pd.DataFrame({'A':[1,2,3,4,5]})
DD.index.name = 'Test'
print DD.index.name
DD.index = DD.index.map(unicode)
print DD.index.name
</code></pre></div>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">The mapping operation deletes the index name.</p>
<p dir="auto">However mapping a function on the index means modifying an existing index, so one would expect the name of the index to stay the same as opposed to when choosing a completely new index.</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="python: 2.7.12.final.0
pandas: 0.19.0"><pre class="notranslate"><code class="notranslate">python: 2.7.12.final.0
pandas: 0.19.0
</code></pre></div>
<h4 dir="auto">EDIT:</h4>
<p dir="auto">Doing a <code class="notranslate">set_index(column)</code> does NOT set the column name as the index name, I think it would be common sense that the name of the column which becomes the new index be automatically set as the index name.</p>
<p dir="auto">Hello,</p>
<p dir="auto">I'm trying to install pandas on Mac OS X 10.11.6 in a Django project. Pandas library is used with one of the 3rd party libraries that I am using in the project.</p>
<p dir="auto">Since I don't want to switch to different package manager (Anakonda) just for installing pandas (I'm using pip now), in order for me to get the C files compiled, I decided to install pandas by including <code class="notranslate">--editable git+git://github.com/pydata/pandas.git@v0.18.1#egg=pandas</code> in the <code class="notranslate">requirements.txt</code> file and the library is now installed in my <code class="notranslate">src</code> dir and there's a symlink in my virtualenv's <code class="notranslate">site-packages</code> which points to it.</p>
<p dir="auto">This gets these headers compiled, but causes many strange importing errors in pandas source code itself when it is imported by a third party library that is also installed with <code class="notranslate">--editable</code> mode. F. ex. file at <code class="notranslate">Users/eimantas/Desktop/Projects/WeShareSolar/mijnstroom/virtualenv/src/knmi-py/knmi/parsers.py</code> has this line <code class="notranslate">import pandas as pd</code>. And I had to edit this code block in <code class="notranslate">virtualenv/src/pandas/pandas/__init__.py</code> for things to work:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="try:
    # XXX: I had to comment this out for things to work:
    # from pandas import hashtable, tslib, lib
    import hashtable, tslib, lib
except ImportError as e:  # pragma: no cover
    module = str(e).lstrip('cannot import name ')  # hack but overkill to use re
    raise ImportError(&quot;C extension: {0} not built. If you want to import &quot;
                      &quot;pandas from the source directory, you may need to run &quot;
                      &quot;'python setup.py build_ext --inplace' to build the C &quot;
                      &quot;extensions first.&quot;.format(module))
"><pre class="notranslate"><code class="notranslate">try:
    # XXX: I had to comment this out for things to work:
    # from pandas import hashtable, tslib, lib
    import hashtable, tslib, lib
except ImportError as e:  # pragma: no cover
    module = str(e).lstrip('cannot import name ')  # hack but overkill to use re
    raise ImportError("C extension: {0} not built. If you want to import "
                      "pandas from the source directory, you may need to run "
                      "'python setup.py build_ext --inplace' to build the C "
                      "extensions first.".format(module))

</code></pre></div>
<p dir="auto">But then another importing error appears here: <code class="notranslate">virtualenv/src/pandas/pandas/core/config.py</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="File &quot;/Users/eimantas/Desktop/Projects/WeShareSolar/mijnstroom/virtualenv/src/pandas/pandas/core/config.py&quot;, line 57, in &lt;module&gt;
    import pandas.compat as compat
AttributeError: 'module' object has no attribute 'compat'"><pre class="notranslate"><code class="notranslate">File "/Users/eimantas/Desktop/Projects/WeShareSolar/mijnstroom/virtualenv/src/pandas/pandas/core/config.py", line 57, in &lt;module&gt;
    import pandas.compat as compat
AttributeError: 'module' object has no attribute 'compat'
</code></pre></div>
<p dir="auto">What should I do to get these things fixed ? I'd love to be able to use this library with pip and Django.</p>