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

pd.concat loses index names with MultiIndex #1683

Closed
dchigarev opened this issue Jul 2, 2020 · 0 comments · Fixed by #1684
Closed

pd.concat loses index names with MultiIndex #1683

dchigarev opened this issue Jul 2, 2020 · 0 comments · Fixed by #1684
Assignees
Labels
bug 🦗 Something isn't working
Milestone

Comments

@dchigarev
Copy link
Collaborator

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • Modin version (modin.__version__): 0.7.3+170.g7a4b735
  • Python version: 3.7.5
  • Code we can use to reproduce:
if __name__ == "__main__":
    import modin.pandas as pd
    import pandas

    kwargs1 = {
        "data": [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
        "columns": pandas.Index(["a", "b", "c"], name="col1")
    }

    kwargs2 = {
        "data": [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
        "columns": pandas.Index(["e", "f", "g"], name="col1")
    }

    md_df1, md_df2 = pd.DataFrame(**kwargs1), pd.DataFrame(**kwargs2)
    pd_df1, pd_df2 = pandas.DataFrame(**kwargs1), pandas.DataFrame(**kwargs2)
    keys = ["first", "second"]

    print("Pandas result:\n", pandas.concat([pd_df1, pd_df2], keys=keys, axis=1).columns)
    print("Modin result:\n", pd.concat([md_df1, md_df2], keys=keys, axis=1).columns)

Output:

Pandas result:
 MultiIndex([( 'first', 'a'),
            ( 'first', 'b'),
            ( 'first', 'c'),
            ('second', 'e'),
            ('second', 'f'),
            ('second', 'g')],
           names=[None, 'col1'])
Modin result:
 MultiIndex([( 'first', 'a'),
            ( 'first', 'b'),
            ( 'first', 'c'),
            ('second', 'e'),
            ('second', 'f'),
            ('second', 'g')],
           )

Describe the problem

Modin version of concat loses index names. That bug seems to appear only when keys parameter specified.

@dchigarev dchigarev added the bug 🦗 Something isn't working label Jul 2, 2020
@dchigarev dchigarev self-assigned this Jul 2, 2020
@aregm aregm added this to the 0.7.4 milestone Jul 2, 2020
@devin-petersohn devin-petersohn changed the title pd.concat loses index names pd.concat loses index names with MultiIndex Jul 7, 2020
devin-petersohn pushed a commit that referenced this issue Jul 22, 2020
Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
aregm pushed a commit to aregm/modin that referenced this issue Sep 16, 2020
…-project#1684)

Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🦗 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants