Skip to content

ENH: Support merging DataFrames on a combination of columns and index levels #14355

Closed
@jonmmease

Description

@jonmmease

Overview

@jorisvandenbossche
As a part of the Pandas 1.0 goal to "Make the index/column distinction less painful (#5677, #8162)" I propose that the df.merge method support merging DataFrames on a combination of columns and index levels.

This could be accomplished in the API by allowing the on, left_on, and right_on keywords to accept a combination of column names and index level names. Any index levels that are joined on would be preserved as index levels in the resulting merged DataFrame, while all other index levels would be removed.

This proposal is in the spirit of #5677 for df.groupby and #14353 for df.sort_values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignCompatpandas objects compatability with Numpy or Python functionsEnhancementMaster TrackerHigh level tracker for similar issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions