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

Top-level Koalas functions - merge #969

Merged
merged 2 commits into from
Oct 30, 2019
Merged

Conversation

itholic
Copy link
Contributor

@itholic itholic commented Oct 29, 2019

Resolves #961

>>> 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

@codecov-io
Copy link

codecov-io commented Oct 29, 2019

Codecov Report

Merging #969 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #969   +/-   ##
=======================================
  Coverage   94.57%   94.57%           
=======================================
  Files          34       34           
  Lines        6487     6487           
=======================================
  Hits         6135     6135           
  Misses        352      352
Impacted Files Coverage Δ
databricks/koalas/namespace.py 87.26% <100%> (+0.11%) ⬆️
databricks/koalas/frame.py 96.02% <0%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b2286bd...afe5066. Read the comment docs.

Copy link
Collaborator

@ueshin ueshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we add a link to docs/source/reference/general_functions.rst?

Otherwise, LGTM.

@itholic
Copy link
Contributor Author

itholic commented Oct 30, 2019

@ueshin Thanks for the comment! just added it

@softagram-bot
Copy link

Softagram Impact Report for pull/969 (head commit: afe5066)

⭐ Change Overview

Showing the changed files, dependency changes and the impact - click for full size
(Open in Softagram Desktop for full details)

📄 Full report

Impact Report explained. Give feedback on this report to [email protected]

@HyukjinKwon HyukjinKwon merged commit be9890d into databricks:master Oct 30, 2019
@itholic itholic deleted the g_merge branch November 6, 2019 05:30
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

Successfully merging this pull request may close these issues.

Top-level Pandas functions - merge
5 participants