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

Implement DataFrame/Series reindex_like #1880

Merged
merged 3 commits into from
Nov 4, 2020

Conversation

LucasG0
Copy link
Contributor

@LucasG0 LucasG0 commented Nov 1, 2020

Hi, this PR implements both DataFrame.reindex_like and Series.reindex_like.
I did not add a test about reindexing MultiIndex columns on single Index columns because it is currently not supported in koalas. Also, as for DataFrame.reindex, there is no test for reindexing single Index columns/index on MultiIndex columns/index, as it is not supported in pandas.

@itholic
Copy link
Contributor

itholic commented Nov 1, 2020

Nice work, @LucasG0 !
Let me take a look after test passing :)

@codecov-io
Copy link

codecov-io commented Nov 1, 2020

Codecov Report

Merging #1880 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1880   +/-   ##
=======================================
  Coverage   94.19%   94.19%           
=======================================
  Files          40       40           
  Lines        9867     9939   +72     
=======================================
+ Hits         9294     9362   +68     
- Misses        573      577    +4     
Impacted Files Coverage Δ
databricks/koalas/missing/frame.py 100.00% <ø> (ø)
databricks/koalas/missing/series.py 100.00% <ø> (ø)
databricks/koalas/frame.py 96.73% <100.00%> (+<0.01%) ⬆️
databricks/koalas/series.py 96.96% <100.00%> (+<0.01%) ⬆️
databricks/koalas/indexes.py 96.82% <0.00%> (-0.46%) ⬇️
databricks/koalas/accessors.py 93.03% <0.00%> (-0.04%) ⬇️
databricks/koalas/base.py 97.38% <0.00%> (-0.01%) ⬇️
databricks/koalas/utils.py 96.07% <0.00%> (ø)
... and 7 more

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 62fb01c...d4e2de8. Read the comment docs.

@LucasG0
Copy link
Contributor Author

LucasG0 commented Nov 2, 2020

Despite Codecov report, coverage seems actually ok.

Copy link
Contributor

@itholic itholic left a comment

Choose a reason for hiding this comment

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

Otherwise, seems fine to me since it's basically based on specific usage of reindex.

databricks/koalas/frame.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Outdated Show resolved Hide resolved
----------
other : Series or DataFrame
Its row and column indices are used to define the new indices
of this object.
Copy link
Contributor

Choose a reason for hiding this comment

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

Anyway, maybe pandas has copy parameter for Series.reindex_like, too ??

Even if it doesn't really do any meaningful work, how about adding it for compatibility with pandas?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes pandas has copy parameter for Series.reindex_like. If we add it, we need to update Series.reindex too, which does not support copy parameter either.
Should I do the change ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... okay let's keep it as it is for now and discuss separately later.
Thanks for the opinion!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok :)

databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/tests/test_dataframe.py Outdated Show resolved Hide resolved
databricks/koalas/tests/test_series.py Outdated Show resolved Hide resolved
@HyukjinKwon
Copy link
Member

awesome, thanks @LucasG0 for working on this.

@itholic
Copy link
Contributor

itholic commented Nov 4, 2020

Great, @LucasG0 !
Looks pretty good to me.
Waiting for others opinion for a while.

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.

databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/frame.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Outdated Show resolved Hide resolved
@ueshin
Copy link
Collaborator

ueshin commented Nov 4, 2020

Thanks! merging.

@ueshin ueshin merged commit ee5d866 into databricks:master Nov 4, 2020
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