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.pop #791

Merged
merged 5 commits into from
Sep 20, 2019
Merged

Implement DataFrame.pop #791

merged 5 commits into from
Sep 20, 2019

Conversation

itholic
Copy link
Contributor

@itholic itholic commented Sep 17, 2019

Resolves #788

like pandas.DataFrame.pop (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pop.html?highlight=pop#pandas.DataFrame.pop) now we can pop column from koalas DataFrame like below:

>>> import databricks.koalas as ks
>>> import numpy as np
>>>
>>> df = ks.DataFrame([('falcon', 'bird', 389.0),
...                   ('parrot', 'bird', 24.0),
...                   ('lion', 'mammal', 80.5),
...                    ('monkey','mammal', np.nan)],
...                   columns=('name', 'class', 'max_speed'))
>>>
>>> df.pop('class')
0      bird
1      bird
2    mammal
3    mammal
Name: class, dtype: object
>>>
>>> df
     name  max_speed
0  falcon      389.0
1  parrot       24.0
2    lion       80.5
3  monkey        NaN

(use pandas.DataFrame.pop example)

Unlike pandas, we should remove column information via internal frame.

and when we remove column from internal frame, maybe we should remove related metadata also (like _data_columns, _column_index ...).

@itholic itholic mentioned this pull request Sep 17, 2019
@codecov-io
Copy link

codecov-io commented Sep 18, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #791      +/-   ##
=========================================
+ Coverage    94.3%   94.3%   +<.01%     
=========================================
  Files          32      32              
  Lines        5828    5831       +3     
=========================================
+ Hits         5496    5499       +3     
  Misses        332     332
Impacted Files Coverage Δ
databricks/koalas/missing/frame.py 100% <ø> (ø) ⬆️
databricks/koalas/frame.py 96.79% <100%> (ø) ⬆️

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 275463a...0ba5c19. Read the comment docs.

@softagram-bot
Copy link

Softagram Impact Report for pull/791 (head commit: 0ba5c19)

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

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.

LGTM.

@ueshin
Copy link
Collaborator

ueshin commented Sep 20, 2019

Thanks! merging.

@ueshin ueshin merged commit 1001ebd into databricks:master Sep 20, 2019
@itholic
Copy link
Contributor Author

itholic commented Sep 21, 2019

@ueshin Thanks :)

@itholic itholic deleted the series_pop branch October 3, 2019 07:36
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.

Implement DataFrame.pop
6 participants