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

ENH: Merge with custom function #55873

Closed
1 of 3 tasks
pwrose opened this issue Nov 7, 2023 · 1 comment
Closed
1 of 3 tasks

ENH: Merge with custom function #55873

pwrose opened this issue Nov 7, 2023 · 1 comment
Labels
Enhancement Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@pwrose
Copy link

pwrose commented Nov 7, 2023

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

Do a fuzzy merge of two dataframes. A custom function could be used to determine if there is a match.

Feature Description

Here is an example how this might look like (this is actually a hallucination by ChatGPT!)

import pandas as pd

df1 = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
df2 = pd.DataFrame({'C': [5, 6], 'D': [7, 8]})

def my_function(x, y):
return x + y

df = pd.merge(df1, df2, left_on='A', right_on='C', custom_func=my_function)

print(df)

Alternative Solutions

I'm not aware of a simple alternative.

Additional Context

No response

@pwrose pwrose added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 7, 2023
@mroeschke
Copy link
Member

Thanks for the request. A similar request has been made in #8962 so closing in favor of that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants