Skip to content

Add numeric_only kwarg to dataframe reductions#7831

Merged
jsignell merged 6 commits intodask:mainfrom
jsignell:numeric_only
Jul 21, 2021
Merged

Add numeric_only kwarg to dataframe reductions#7831
jsignell merged 6 commits intodask:mainfrom
jsignell:numeric_only

Conversation

@jsignell
Copy link
Copy Markdown
Member

This implementation might seem kind of intense, but I was thinking that it would be most efficient to pull out the numeric_only columns at the beginning rather than passing the arg down into the chunk functions.

Regarding tests, I chose to leave in the old test to make sure that existing functionality isn't affected at all, and I made a new test to test out the numeric_only kwarg.

def _numeric_only(func):
@wraps(func)
def wrapper(self, *args, **kwargs):
if kwargs.get("numeric_only") is False:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The default value here is always None, which gives the previous behaviour of all the affected functions?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yep!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK, then I'm totally on board with this PR, I just recommend some text here in the decorator function to describe what its for.

@jsignell jsignell merged commit cb4be3e into dask:main Jul 21, 2021
@jsignell jsignell deleted the numeric_only branch July 21, 2021 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement numeric_only kwarg for dask.dataframe reductions

2 participants