Skip to content

Conversation

@HyukjinKwon
Copy link
Member

@HyukjinKwon HyukjinKwon commented Mar 12, 2020

Looks pandas conditionally uses iloc approach when the input is int against index operators in Series and Frame.

import databricks.koalas as ks
import pandas as pd
import numpy as np

dates = pd.date_range('20130101', periods=6)
pdf = pd.DataFrame(np.random.randn(6,4), index=dates, columns=list('ABCD'))
kdf = ks.from_pandas(pdf)
kdf[0:3]
                   A         B         C         D
2013-01-01  2.143975 -2.069608 -0.013988 -0.311598
2013-01-02 -0.448577  0.076479 -0.356269  0.965872
2013-01-03  0.203477  0.738288 -1.453629 -0.146019

Resolves #287

@HyukjinKwon HyukjinKwon requested a review from ueshin March 12, 2020 03:25
@HyukjinKwon HyukjinKwon changed the title Fix index operator against Series and Frame to use iloc conditionally [WIP] Fix index operator against Series and Frame to use iloc conditionally Mar 12, 2020
@HyukjinKwon HyukjinKwon changed the title [WIP] Fix index operator against Series and Frame to use iloc conditionally Fix index operator against Series and Frame to use iloc conditionally Mar 12, 2020
@codecov-io
Copy link

codecov-io commented Mar 12, 2020

Codecov Report

Merging #1336 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1336      +/-   ##
==========================================
+ Coverage   95.15%   95.17%   +0.01%     
==========================================
  Files          34       34              
  Lines        7472     7476       +4     
==========================================
+ Hits         7110     7115       +5     
+ Misses        362      361       -1     
Impacted Files Coverage Δ
databricks/koalas/frame.py 96.71% <100.00%> (+<0.01%) ⬆️
databricks/koalas/series.py 96.74% <100.00%> (+<0.01%) ⬆️
databricks/koalas/indexing.py 95.28% <0.00%> (+0.24%) ⬆️

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 e4e5a1c...2692282. Read the comment docs.

@itholic
Copy link
Contributor

itholic commented Mar 12, 2020

LGTM

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.
btw, the PR description does not make sense? maybe need to add some examples accessing by index operator?

@HyukjinKwon
Copy link
Member Author

oops, sure. I missed the line from the issue.

@HyukjinKwon HyukjinKwon merged commit 2471502 into databricks:master Mar 13, 2020
@HyukjinKwon
Copy link
Member Author

Merged! thanks, @ueshin and @itholic

@HyukjinKwon HyukjinKwon deleted the index-operator branch September 11, 2020 07:52
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.

Cannot select [] with dates as index

4 participants