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 Series.drop #829

Merged
merged 20 commits into from
Oct 2, 2019
Merged

Implement Series.drop #829

merged 20 commits into from
Oct 2, 2019

Conversation

itholic
Copy link
Contributor

@itholic itholic commented Sep 25, 2019

Resolves #822

Like pandas Series.drop (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.drop.html#pandas.Series.drop)

I implemented drop function for series.

Example:

>>> s = ks.Series(data=np.arange(3), index=['A', 'B', 'C'])
>>> s
A    0
B    1
C    2
Name: 0, dtype: int64
>>>
>>> s.drop('A')
B    1
C    2
Name: 0, dtype: int64
>>>
>>> s.drop(labels=['B', 'C'])
A    0
Name: 0, dtype: int64

Also Support for MultiIndex

>>> midx = pd.MultiIndex(levels=[['lama', 'cow', 'falcon'],
...                              ['speed', 'weight', 'length']],
...                      codes=[[0, 0, 0, 1, 1, 1, 2, 2, 2],
...                             [0, 1, 2, 0, 1, 2, 0, 1, 2]])
>>> s = ks.Series([45, 200, 1.2, 30, 250, 1.5, 320, 1, 0.3],
...               index=midx)
>>> s
lama    speed      45.0
        weight    200.0
        length      1.2
cow     speed      30.0
        weight    250.0
        length      1.5
falcon  speed     320.0
        weight      1.0
        length      0.3
Name: 0, dtype: float64

>>> s.drop(labels='weight', level=1)
lama    speed      45.0
        length      1.2
cow     speed      30.0
        length      1.5
falcon  speed     320.0
        length      0.3
Name: 0, dtype: float64

(above examples are using pandas one)

@codecov-io
Copy link

codecov-io commented Sep 25, 2019

Codecov Report

Merging #829 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #829      +/-   ##
=========================================
+ Coverage   94.27%   94.3%   +0.02%     
=========================================
  Files          34      34              
  Lines        6150    6181      +31     
=========================================
+ Hits         5798    5829      +31     
  Misses        352     352
Impacted Files Coverage Δ
databricks/koalas/missing/series.py 100% <ø> (ø) ⬆️
databricks/koalas/series.py 95.33% <100%> (+0.25%) ⬆️

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 1003df7...40acfe0. Read the comment docs.

databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Show resolved Hide resolved
@itholic
Copy link
Contributor Author

itholic commented Sep 30, 2019

@ueshin I just resolved build failure here related with python 3.5 compatibility. Could you check this PR if maybe when you available? 😄

databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Outdated Show resolved Hide resolved
databricks/koalas/series.py Outdated Show resolved Hide resolved
@softagram-bot
Copy link

Softagram Impact Report for pull/829 (head commit: 40acfe0)

⭐ 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 Oct 2, 2019

Thanks! merging.

@ueshin ueshin merged commit a642ae6 into databricks:master Oct 2, 2019
@itholic
Copy link
Contributor Author

itholic commented Oct 2, 2019

@ueshin Thanks for reviewing this 😃

@itholic itholic deleted the series_drop 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 Series.drop
4 participants