Skip to content

ENH:Create Set Operations #42177

Open
Open
@tlplayer

Description

@tlplayer

Is your feature request related to a problem?

I wish to take the AND, OR, XOR, and NOT of dataframes. Of course I could do this manually but an inbuilt way would be far cleaner and elegant.

Possible Solution

Example 1:

A = {'a': 1 2 3}
B = {'a': 1 3 4}

pandas.xor(A,B, on = "a")

{'a': 2 4}

Example 2:

A.or( B, on= "a")

{'a': 1 2 3 4}

Example 3:

A.and(B,on='a')

{'a': 1 3}

API breaking implications

It will not affect the API it is just a convenience feature.

Additional context

Typically when comparing data from 2 sources, fields will not correlate and need to be cleaned through basic and, or, nor, and not, and xor operations. This would speed up greatly those tasks.

Code to come later wanting to hear you're thoughts on implementation first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNeeds DiscussionRequires discussion from core team before further actionsetopsunion, intersection, difference, symmetric_difference

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions