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

[FEA] Use `_get_numeric_types` in numeric reductions #2067

Open
mrocklin opened this issue Jun 21, 2019 · 1 comment
Open

[FEA] Use `_get_numeric_types` in numeric reductions #2067

mrocklin opened this issue Jun 21, 2019 · 1 comment

Comments

@mrocklin
Copy link
Member

@mrocklin mrocklin commented Jun 21, 2019

If would be great if the following worked:

import cudf
df = cudf.datasets.timeseries()
df.mean()

Currently we get this

AttributeError: 'CategoricalColumn' object has no attribute 'mean'

Typically the solution in Pandas is to strip out the non-numeric columns first

df._get_numeric_data().mean()

We should consider adding this method call in all dataframe reductions that expect numeric data like sum, mean, prod, std, var, cum* and so on.

@mrocklin
Copy link
Member Author

@mrocklin mrocklin commented Jun 21, 2019

So to be fully explicit we would want changes like the following:

def mean(self, *kwargs):
-    return self._apply_support_method('mean', **kwargs)
+    return self._get_numeric_data()._apply_support_method('mean', **kwargs)

Along with tests that this works when we have a small dataframe with both numeric and text dtypes.

@kkraus14 kkraus14 added this to Needs prioritizing in Feature Planning via automation Jun 27, 2019
@kkraus14 kkraus14 removed this from Needs prioritizing in Feature Planning Aug 15, 2019
@kkraus14 kkraus14 added this to Issue-Needs prioritizing in v0.10 Release via automation Aug 15, 2019
@kkraus14 kkraus14 moved this from Issue-Needs prioritizing to Issue-P1 in v0.10 Release Sep 11, 2019
@kkraus14 kkraus14 moved this from Issue-P1 to Issue-P2 in v0.10 Release Sep 11, 2019
@kkraus14 kkraus14 added this to Issue-Needs prioritizing in v0.11 Release via automation Sep 30, 2019
@kkraus14 kkraus14 removed this from Issue-P2 in v0.10 Release Sep 30, 2019
@kkraus14 kkraus14 moved this from Issue-Needs prioritizing to Issue-P1 in v0.11 Release Oct 1, 2019
@kkraus14 kkraus14 added this to Issue-Needs prioritizing in v0.12 Release via automation Dec 6, 2019
@kkraus14 kkraus14 removed this from Issue-P1 in v0.11 Release Dec 6, 2019
@kkraus14 kkraus14 added this to Issue-Needs prioritizing in v0.13 Release via automation Jan 21, 2020
@kkraus14 kkraus14 removed this from Issue-Needs prioritizing in v0.12 Release Jan 21, 2020
@kkraus14 kkraus14 moved this from Issue-Needs prioritizing to Issue-P2 in v0.13 Release Jan 23, 2020
@harrism harrism added this to Needs prioritizing in Feature Planning via automation Mar 12, 2020
@harrism harrism removed this from Issue-P2 in v0.13 Release Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Feature Planning
Needs prioritizing
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.