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

Merge with on column condition #642

Closed
dagarshali opened this issue Mar 3, 2022 · 2 comments
Closed

Merge with on column condition #642

dagarshali opened this issue Mar 3, 2022 · 2 comments

Comments

@dagarshali
Copy link

The example pane for merge shows that you can merge, say left join with a common column as the join condition. However, that is not what shows up the code that you see when you add the two dataframes, you see left=index and right=index. How do you change this behavior?

@aschonfeld
Copy link
Collaborator

Not sure why you would want to change it. This code should work (FYI: I did fix some small frontend bugs that I'll release soon):

import dtale
from dtale.views import startup

df1 = dtale.get_instance('1').data.set_index(['category_val'])
df2 = dtale.get_instance('1').data.set_index(['Col0'])
final_df = df1.merge(df2, how='left', left_index=True, right_index=True)
startup(final_df)

image

The difference with setting the column names versus saying left_index=True, right_index=True is that I'm turning the selected columns into indexes before using them in a merge. Which should be the same as passing them in manually.

aschonfeld added a commit that referenced this issue Mar 11, 2022
@aschonfeld
Copy link
Collaborator

@dagarshali just released v2.1.0 with some fixes. Please let me know if you're still having issues. Also, if you haven't already, please put your ⭐ on the repo. Thanks 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants