-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[DataFrame] Implement loc, iloc #1612
Conversation
Test PASSed. |
Test PASSed. |
Test PASSed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of minor changes. Looking good!
python/ray/dataframe/indexing.py
Outdated
df, idx_lst, col_idx): return df.iloc[idx_lst, col_idx] | ||
|
||
retrieved_rows_remote = [] | ||
for partition, idx_to_lookup in lookup_dict.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to wrap this in list comprehension:
retrieved_rows_remote = [_deploy_func.remote(retrieve_func, self.df._df[partition], idx_to_lookup, col_list) for partition, idx_to_lookup in lookup_dict.items()]
python/ray/dataframe/indexing.py
Outdated
from .dataframe import _deploy_func | ||
|
||
|
||
def _row_tuples_to_dict(row_tuples): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be faster to do a self._index.groupby('partition')
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Thanks @simon-mo !
Test PASSed. |
Passed on private-travis with unrelated failures. OK to merge. Thanks @simon-mo! |
What do these changes do?
This PR implements basic
loc
andiloc
for the dataframe.Out of five allowed inputs, this PR implements the most commonly used three:
A boolean array.A callable function with one argument (the calling Series, DataFrame or Panel) and that returns valid output for indexing (one of the above)Related issue number