-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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] Added Implementations for equals, query, and some other operations #1610
Conversation
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.
This is great! Just a few comments and minor changes.
@@ -1224,10 +1248,33 @@ def test_quantile(): | |||
|
|||
|
|||
def test_query(): | |||
ray_df = create_test_dataframe() | |||
def generate_data(): |
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 these be in @pytest.fixture
calls and pass the different dataframes to it.
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.
You can also pass in what you want to query for.
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.
Done.
python/ray/dataframe/dataframe.py
Outdated
@@ -192,6 +201,15 @@ def _map_partitions(self, func, index=None): | |||
|
|||
return DataFrame(new_df, self.columns, index=index) | |||
|
|||
def _update_inplace(self, new_dfs): |
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.
If we're adding this convenience method (which I agree is a good idea) we will also need to update columns
and index
.
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 added them, and you can update just the fields you want.
python/ray/dataframe/dataframe.py
Outdated
@@ -72,6 +75,12 @@ def _default_index(self): | |||
|
|||
index = property(_get_index, _set_index) | |||
|
|||
def _update_lengths(self): |
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.
Prefer name change to _compute_lengths()
. We have a set and the name doesn't sound much different.
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.
Done.
python/ray/dataframe/dataframe.py
Outdated
def _update_inplace(self, new_dfs): | ||
"""Updates the current DataFrame inplace | ||
""" | ||
assert(len(new_dfs) > 0) |
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.
DataFrames can be empty. This is fine to leave for now, but we need to handle this case (also above in the constructor)
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 agree, I just conformed to the current constructor for now, but this should be changed later.
3b45aef
to
bfbd34e
Compare
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.
Looks great!
Passed on private-travis. OK to merge. Thanks @kunalgosar! |
What do these changes do?
The APIs for these implementations conform to that of pandas, many of the other operators rely on mapped calls to pandas functions.
This PR implements: