Skip to content

Conversation

@itholic
Copy link
Contributor

@itholic itholic commented Feb 18, 2020

This PR proposes Implement of DataFrame.take

>>> df = ks.DataFrame([('falcon', 'bird', 389.0),
...                    ('parrot', 'bird', 24.0),
...                    ('lion', 'mammal', 80.5),
...                    ('monkey', 'mammal', np.nan)],
...                   columns=['name', 'class', 'max_speed'],
...                   index=[0, 2, 3, 1])
>>> df
     name   class  max_speed
0  falcon    bird      389.0
2  parrot    bird       24.0
3    lion  mammal       80.5
1  monkey  mammal        NaN

>>> df.take([0, 3])
     name   class  max_speed
0  falcon    bird      389.0
1  monkey  mammal        NaN

>>> df.take([1, 2], axis=1)
    class  max_speed
0    bird      389.0
2    bird       24.0
3  mammal       80.5
1  mammal        NaN

>>> df.take([-1, -2])
     name   class  max_speed
1  monkey  mammal        NaN
3    lion  mammal       80.5

@codecov-io
Copy link

codecov-io commented Feb 18, 2020

Codecov Report

Merging #1292 into master will decrease coverage by 2.20%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1292      +/-   ##
==========================================
- Coverage   95.23%   93.02%   -2.21%     
==========================================
  Files          34       34              
  Lines        7576     7617      +41     
==========================================
- Hits         7215     7086     -129     
- Misses        361      531     +170     
Impacted Files Coverage Δ
databricks/koalas/missing/frame.py 100.00% <ø> (ø)
databricks/koalas/frame.py 93.67% <100.00%> (-3.05%) ⬇️
databricks/koalas/usage_logging/__init__.py 24.32% <0.00%> (-71.18%) ⬇️
databricks/koalas/usage_logging/usage_logger.py 50.00% <0.00%> (-50.00%) ⬇️
databricks/koalas/__init__.py 78.72% <0.00%> (-14.90%) ⬇️
databricks/conftest.py 88.67% <0.00%> (-7.55%) ⬇️
databricks/koalas/namespace.py 86.26% <0.00%> (-1.50%) ⬇️
databricks/koalas/plot.py 93.33% <0.00%> (-0.96%) ⬇️
databricks/koalas/generic.py 97.13% <0.00%> (-0.41%) ⬇️
... and 2 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 da3740d...acc369a. Read the comment docs.

@itholic itholic changed the title Implement DataFrame.take [WIP] Implement DataFrame.take Feb 18, 2020
@itholic
Copy link
Contributor Author

itholic commented Feb 18, 2020

We have to find another solution since map_in_pandas won't work for this method.

While i'm here, i'm searching and fixing the existing implementations.

@itholic itholic changed the title [WIP] Implement DataFrame.take Implement DataFrame.take Mar 18, 2020
@ueshin
Copy link
Collaborator

ueshin commented Mar 18, 2020

Seems like we can just delegate to iloc indexer?

@itholic
Copy link
Contributor Author

itholic commented Mar 19, 2020

@ueshin Ah, I should have took a look at more carefully. Thanks for the comment :)

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.

@ueshin
Copy link
Collaborator

ueshin commented Mar 19, 2020

Could you update the PR description?

@itholic
Copy link
Contributor Author

itholic commented Mar 19, 2020

@ueshin Yup, I just removed unmatched descriptions

@ueshin
Copy link
Collaborator

ueshin commented Mar 20, 2020

Thanks! merging.

@ueshin ueshin merged commit 5d8dee1 into databricks:master Mar 20, 2020
@itholic itholic deleted the f_take branch March 20, 2020 00:26
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.

4 participants