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

[DataFrame] Added Implementations for equals, query, and some other operations #1610

Merged
merged 8 commits into from
Feb 27, 2018

Conversation

kunalgosar
Copy link
Contributor

@kunalgosar kunalgosar commented Feb 26, 2018

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:

  1. equals
  2. query
  3. __ iter__
  4. __ abs__
  5. __ eq__
  6. __ ne__
  7. __ neg__

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/3971/
Test PASSed.

Copy link
Member

@devin-petersohn devin-petersohn left a 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():
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -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):
Copy link
Member

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.

Copy link
Contributor Author

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.

@@ -72,6 +75,12 @@ def _default_index(self):

index = property(_get_index, _set_index)

def _update_lengths(self):
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

def _update_inplace(self, new_dfs):
"""Updates the current DataFrame inplace
"""
assert(len(new_dfs) > 0)
Copy link
Member

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)

Copy link
Contributor Author

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.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/3981/
Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/3982/
Test PASSed.

Copy link
Member

@devin-petersohn devin-petersohn left a comment

Choose a reason for hiding this comment

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

Looks great!

@devin-petersohn
Copy link
Member

Passed on private-travis. OK to merge. Thanks @kunalgosar!

@devin-petersohn devin-petersohn merged commit 48bd7b1 into ray-project:master Feb 27, 2018
@kunalgosar kunalgosar deleted the dataframes branch February 27, 2018 02:48
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.

3 participants