Skip to content

Conversation

@itholic
Copy link
Contributor

@itholic itholic commented Oct 17, 2019

Resolves #933

>>> kser = ks.Series([10, 20, 15, 30, 45], ['A', 'A', 'B', 'C', 'D'])
>>> kser['A']
A    10
A    20
Name: 0, dtype: int64
>>>
>>> kser['B']
15

For MultiIndex

>>> midx = pd.MultiIndex([['lama', 'cow', 'falcon'],
...                       ['speed', 'weight', 'length']],
...                      [[0, 0, 0, 1, 1, 1, 2, 2, 2],
...                       [0, 1, 2, 0, 1, 2, 0, 1, 2]])
>>> kser = ks.Series([45, 200, 1.2, 30, 250, 1.5, 320, 1, 0.3], index=midx)
>>> pser = kser.to_pandas()

>>> kser['lama']
speed      45.0
weight    200.0
length      1.2
Name: 0, dtype: float64

>>> pser['lama']
speed      45.0
weight    200.0
length      1.2
Name: 0, dtype: float64

@codecov-io
Copy link

codecov-io commented Oct 17, 2019

Codecov Report

Merging #934 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #934      +/-   ##
==========================================
+ Coverage   94.47%   94.49%   +0.01%     
==========================================
  Files          34       34              
  Lines        6392     6425      +33     
==========================================
+ Hits         6039     6071      +32     
- Misses        353      354       +1
Impacted Files Coverage Δ
databricks/koalas/series.py 95.86% <100%> (+0.25%) ⬆️
databricks/koalas/utils.py 97.97% <100%> (+0.02%) ⬆️
databricks/koalas/indexes.py 96.42% <0%> (-0.96%) ⬇️
databricks/koalas/missing/indexes.py 100% <0%> (ø) ⬆️
databricks/koalas/base.py 94.83% <0%> (+0.03%) ⬆️

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 580f48c...1ce3226. Read the comment docs.

@ueshin ueshin mentioned this pull request Oct 18, 2019
@ueshin
Copy link
Collaborator

ueshin commented Oct 18, 2019

Seems like the examples for MultiIndex are different between Koalas and pandas?

@itholic
Copy link
Contributor Author

itholic commented Oct 19, 2019

@ueshin oops, i think it was just my mistake

they actually work same.

>>> midx = pd.MultiIndex([['lama', 'cow', 'falcon'],
...                       ['speed', 'weight', 'length']],
...                      [[0, 0, 0, 1, 1, 1, 2, 2, 2],
...                       [0, 1, 2, 0, 1, 2, 0, 1, 2]])
>>> kser = ks.Series([45, 200, 1.2, 30, 250, 1.5, 320, 1, 0.3], index=midx)
>>> pser = kser.to_pandas()

>>> kser['lama']
speed      45.0
weight    200.0
length      1.2
Name: 0, dtype: float64

>>> pser['lama']
speed      45.0
weight    200.0
length      1.2
Name: 0, dtype: float64

(fix existing example in PR description also)

Copy link
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

Looks good otherwise.

@softagram-bot
Copy link

Softagram Impact Report for pull/934 (head commit: 1ce3226)

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

@HyukjinKwon HyukjinKwon merged commit c4921b0 into databricks:master Oct 22, 2019
@itholic itholic deleted the s_getitem branch October 23, 2019 04:25
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.

getitem for Series doesn't work properly

5 participants