-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: index.name not preserved in concat in case of unequal object index #13475
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
Comments
pls make this copy pastable rather than using actual files |
Do you want me to paste in tab-delimited text? |
Done. |
@dllahr pls edit so I can literally copy and past it,
then one can simply copy and paste. This is most useful for reproductions, but also to facilitate checking if this is even an existing bug. |
I think I have the same problem. Should be reproducible with this code:
I expected the output of Can anybody reproduce this? Is this expected behavior, and if so why? Output of
|
Can you remove the can't Repro label, because the new comment has the formatting you require? |
@dllahr how so? need an example that one can simply literaally copy-paste. Don't use files.
|
@dllahr pls put this actual example and replace the top part of the PR in that case. Its too confusing. |
Well there's the comment by vkcelik before I did anything. |
How about now? |
the tabs don't reproduce when copy-pasting. and the example should be much simpler. The idea is to make this into a test. If its too much effort it won't happen. |
Awesome. If the problem is related to parsing the tab delimited input, then how are you going to reproduce it? I've given you more than enough information to reproduce this bug, if you choose to ignore it, that's your business. I'll keep that in mind next time someone asks me about Pandas. |
@dllahr that's quite a poor attitude |
I agree you are displaying a poor attitude. |
@dllahr please see http://stackoverflow.com/help/mcve Tools like pandas are successful because of community contributions. We get a lot of bug reports, so every bit of help making an issue easier to reproduce helps. |
@dllahr As an example, I tried to reproduce this with a simple example:
So the issue seems to be with a string index that is not equal, as when the index of the two frames is equal (no NaNs are introduced), the name is kept:
and when using a numerical index, the name is also kept:
|
@jorisvandenbossche thank you for finding a much better example. @shoyer Thank you for that, but I provided the minimal example that I could deduce given my time constraints and abilities. If I could have provided a simpler example, I would have. As some feedback for you (collectively), given this "experience" I'm pretty sure next time I just won't bother reporting any bug or issue I find. |
Apologies if any of that came of brusque @dllahr, trying to manage the crazy numbers of issues efficiently. Need to leverage your first-hand experience with the bug as much as possible to diagnose the issue. Thanks for the report! |
experiencing the same bug on pandas 0.24.2 |
I believe I have a 2 line fix to |
xref #13742 for addl cases.
So the issue seems to be with a string index that is not equal, as when the index of the two frames is equal (no NaNs are introduced), the name is kept and also when using numerical indexes, see #13475 (comment)
When I use the concat function with input dataframes that have index.name assigned, sometimes the resulting dataframe has the index.name assigned, sometimes it does not.
I ran the code below from the python interpreter, using a conda environment with pandas-0.18.1
I don't see any odd / extra characters around the "pert_well" column in the files between the files.
Code Sample, a copy-pastable example if possible
results:
Expected Output
c.index.name should be "pert_well"
output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.11.final.0
python-bits: 64
OS: Linux
OS-release: 2.6.32-573.7.1.el6.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: C
pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 23.0.0
Cython: None
numpy: 1.11.0
scipy: None
statsmodels: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: None
pandas_datareader: None
PMEL_input_files_for_pandas_issue.zip
The text was updated successfully, but these errors were encountered: