-
Notifications
You must be signed in to change notification settings - Fork 358
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
Top-level Pandas functions - merge #961
Labels
enhancement
New feature or request
Comments
Thanks for posting issue. i'm going to work on this. |
Please go ahead!! |
@HyukjinKwon i just finished. could you check related PR when you available? |
HyukjinKwon
pushed a commit
that referenced
this issue
Oct 30, 2019
Resolves #961 ```python >>> df1 = ks.DataFrame({'lkey': ['foo', 'bar', 'baz', 'foo'], ... 'value': [1, 2, 3, 5]}, ... columns=['lkey', 'value']) >>> df2 = ks.DataFrame({'rkey': ['foo', 'bar', 'baz', 'foo'], ... 'value': [5, 6, 7, 8]}, ... columns=['rkey', 'value']) >>> df1 lkey value 0 foo 1 1 bar 2 2 baz 3 3 foo 5 >>> df2 rkey value 0 foo 5 1 bar 6 2 baz 7 3 foo 8 >>> merged = ks.merge(df1, df2, left_on='lkey', right_on='rkey') >>> merged.sort_values(by=['lkey', 'value_x', 'rkey', 'value_y']) lkey value_x rkey value_y 0 bar 2 bar 6 5 baz 3 baz 7 1 foo 1 foo 5 2 foo 1 foo 8 3 foo 5 foo 5 4 foo 5 foo 8 >>> left_kdf = ks.DataFrame({'A': [1, 2]}) >>> right_kdf = ks.DataFrame({'B': ['x', 'y']}, index=[1, 2]) >>> ks.merge(left_kdf, right_kdf, left_index=True, right_index=True) A B 1 2 x >>> ks.merge(left_kdf, right_kdf, left_index=True, right_index=True, how='left') A B 0 1 None 1 2 x >>> ks.merge(left_kdf, right_kdf, left_index=True, right_index=True, how='right') A B 1 2.0 x 2 NaN y >>> ks.merge(left_kdf, right_kdf, left_index=True, right_index=True, how='outer') A B 0 1.0 None 1 2.0 x 2 NaN y ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://pandas.pydata.org/pandas-docs/stable/reference/general_functions.html
The text was updated successfully, but these errors were encountered: