Skip to content

Implement Series.between #997

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

Merged
merged 4 commits into from
Nov 5, 2019
Merged

Conversation

harupy
Copy link
Contributor

@harupy harupy commented Nov 4, 2019

Implement Series.between

@softagram-bot
Copy link

Softagram Impact Report for pull/997 (head commit: 6b6f73c)

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

@codecov-io
Copy link

codecov-io commented Nov 4, 2019

Codecov Report

Merging #997 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #997      +/-   ##
==========================================
+ Coverage   94.84%   94.84%   +<.01%     
==========================================
  Files          34       34              
  Lines        6516     6524       +8     
==========================================
+ Hits         6180     6188       +8     
  Misses        336      336
Impacted Files Coverage Δ
databricks/koalas/missing/series.py 100% <ø> (ø) ⬆️
databricks/koalas/series.py 96.34% <100%> (+0.03%) ⬆️
databricks/koalas/window.py 93.05% <0%> (+0.19%) ⬆️

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 5845ed9...6b6f73c. 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.

Otherwise, LGTM.

Comment on lines +680 to +683
left : scalar or list-like
Left boundary.
right : scalar or list-like
Right boundary.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add a test if we can support list-like?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@harupy harupy Nov 4, 2019

Choose a reason for hiding this comment

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

pandas supports list-like.
pandas-dev/pandas#28435

Copy link
Collaborator

Choose a reason for hiding this comment

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

cool!
Then shall we add tests for them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

>>> a = ks.Series([1, 2, 3])
>>> b = ks.Series([4, 5, 6])
>>> a > b

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/harutaka/Desktop/projects/koalas/databricks/koalas/base.py", line 66, in wrapper
    return align_diff_series(apply_func, self, *args, how="full")
  File "/Users/harutaka/Desktop/projects/koalas/databricks/koalas/utils.py", line 255, in align_diff_series
    combined = combine_frames(this_series.to_frame(), *cols, how=how)
  File "/Users/harutaka/Desktop/projects/koalas/databricks/koalas/utils.py", line 116, in combine_frames
    raise ValueError("Cannot combine column argument because "
ValueError: Cannot combine column argument because it comes from a different dataframe

I got this error when I tried to compare two different series.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This works.

>>> df = ks.DataFrame({
    'a': [1, 2, 3],
    'b': [4, 5, 6],
    'c': [7, 8, 9]
})

>>> df.a < df.b
0    True
1    True
2    True
Name: a, dtype: bool

>>> df.b < df.c
0    True
1    True
2    True
Name: b, dtype: bool

Copy link
Member

Choose a reason for hiding this comment

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

For different dataframe, you can add the tests under test_ops_on_diff_frames.py. compute.ops_on_diff_frames option allows operations on different DataFrames.

@HyukjinKwon HyukjinKwon merged commit e577313 into databricks:master Nov 5, 2019
@HyukjinKwon
Copy link
Member

Let me just merge - it looks pretty straightforward.

@harupy
Copy link
Contributor Author

harupy commented Nov 5, 2019

@HyukjinKwon Thanks. I'll create a PR to add tests.

HyukjinKwon pushed a commit that referenced this pull request Nov 5, 2019
Add `Series.between` to the doc in #997.
@harupy harupy deleted the series-between branch November 5, 2019 12:08
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.

5 participants