Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6c33a0a
numeric_only support for simple aggs, WIP.
j-bennet Jan 27, 2023
48d2203
Merge remote-tracking branch 'upstream/main' into j-bennet/9736-group…
j-bennet Jan 27, 2023
9a17e68
Use the same warning behavior as pandas with default numeric_only.
j-bennet Jan 27, 2023
56de96f
test-upstream
j-bennet Jan 27, 2023
0acb5af
Check names in test too.
j-bennet Jan 27, 2023
01f3c65
Make sure we raise when numeric_only=False is not supported.
j-bennet Jan 27, 2023
b5558eb
test-upstream
j-bennet Jan 27, 2023
8b877b5
We need to pass numeric_only to agg function as well.
j-bennet Jan 27, 2023
7c87fe6
test-upstream
j-bennet Jan 27, 2023
489b8f4
Merge remote-tracking branch 'upstream/main' into j-bennet/9736-group…
Jan 31, 2023
4ef474a
Review feedback.
j-bennet Jan 31, 2023
9d314d2
Minor updates
jrbourbeau Jan 31, 2023
46cd7b4
Fix failing tests.
j-bennet Feb 1, 2023
f0987f8
Small change in test to make sure we test warning context, even if ex…
j-bennet Feb 1, 2023
3acadbf
test-upstream
j-bennet Feb 1, 2023
2f50ab2
Fix for pandas 1.3.
j-bennet Feb 1, 2023
791242d
More test fixes.
j-bennet Feb 1, 2023
9ffd076
test-upstream
j-bennet Feb 1, 2023
fe5ac6f
Fix for pandas < 1.5.
j-bennet Feb 1, 2023
a6a9ae7
test-upstream
j-bennet Feb 1, 2023
afdf614
Fix more upstream failures.
j-bennet Feb 1, 2023
02dbbbd
test-upstream
j-bennet Feb 1, 2023
30c6ac2
Linting.
j-bennet Feb 1, 2023
fb3e4d3
test-upstream
j-bennet Feb 1, 2023
590ea77
Fix incorrect warning syntax.
j-bennet Feb 1, 2023
4612f32
Merge remote-tracking branch 'upstream/main' into j-bennet/9736-group…
j-bennet Feb 1, 2023
88286cc
numeric_only=False also not implemented with pandas<1.5.
j-bennet Feb 1, 2023
f75d265
Add datetimes to test data.
j-bennet Feb 2, 2023
04cb9b6
Ignore warning decorator on tests.
j-bennet Feb 2, 2023
1d66249
Ignore warning decorator on more tests, where we don't specifically c…
j-bennet Feb 2, 2023
a4a2872
Remove commented code.
j-bennet Feb 2, 2023
a2b3f74
Review feedback.
j-bennet Feb 2, 2023
0b6171e
Review feedback.
j-bennet Feb 2, 2023
a9e27d9
Skip problematic test_reductions_frame_dtypes cases
jrbourbeau Feb 3, 2023
211c6e8
Merge branch 'main' of https://github.com/dask/dask into j-bennet/973…
jrbourbeau Feb 6, 2023
8c446ac
Updates
jrbourbeau Feb 7, 2023
3e629d9
Use check_numeric_only_deprecation in mean and std
jrbourbeau Feb 7, 2023
d08f275
Don't support numeric_only for pandas<1.5
jrbourbeau Feb 8, 2023
504c9f1
Remove unneeded warning ignore
jrbourbeau Feb 8, 2023
e4bc650
Factor out nuisance columns warning into own utility
jrbourbeau Feb 9, 2023
87d543d
Don't assert specific number of warnings
jrbourbeau Feb 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions dask/dataframe/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,30 @@ def makeMixedDataFrame():

@contextlib.contextmanager
def check_numeric_only_deprecation():

if PANDAS_GT_150:
if PANDAS_GT_150 and not PANDAS_GT_200:
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message="The default value of numeric_only in",
message="The default value of numeric_only",
category=FutureWarning,
)
yield
else:
yield


@contextlib.contextmanager
def check_nuisance_columns_warning():
if PANDAS_GT_130 and not PANDAS_GT_150:
with warnings.catch_warnings(record=True):
warnings.filterwarnings(
"ignore", "Dropping of nuisance columns", FutureWarning
)
yield
else:
yield


def dtype_eq(a: type, b: type) -> bool:
# CategoricalDtype in pandas <1.3 cannot be compared to numpy dtypes
if not PANDAS_GT_130 and isinstance(a, pd.CategoricalDtype) != isinstance(
Expand Down
7 changes: 4 additions & 3 deletions dask/dataframe/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
PANDAS_GT_150,
PANDAS_GT_200,
PANDAS_VERSION,
check_nuisance_columns_warning,
check_numeric_only_deprecation,
)
from dask.dataframe.accessor import CachedAccessor, DatetimeAccessor, StringAccessor
Expand Down Expand Up @@ -2236,7 +2237,7 @@ def mean(
axis = self._validate_axis(axis, none_is_zero=not PANDAS_GT_200)
_raise_if_object_series(self, "mean")
# NOTE: Do we want to warn here?
with check_numeric_only_deprecation():
with check_numeric_only_deprecation(), check_nuisance_columns_warning():
meta = self._meta_nonempty.mean(
axis=axis, skipna=skipna, numeric_only=numeric_only
)
Expand Down Expand Up @@ -2316,7 +2317,7 @@ def var(
):
axis = self._validate_axis(axis)
_raise_if_object_series(self, "var")
with check_numeric_only_deprecation():
with check_numeric_only_deprecation(), check_nuisance_columns_warning():
meta = self._meta_nonempty.var(
axis=axis, skipna=skipna, numeric_only=numeric_only
)
Expand Down Expand Up @@ -2467,7 +2468,7 @@ def std(
_raise_if_object_series(self, "std")
_raise_if_not_series_or_dataframe(self, "std")

with check_numeric_only_deprecation():
with check_numeric_only_deprecation(), check_nuisance_columns_warning():
meta = self._meta_nonempty.std(
axis=axis, skipna=skipna, numeric_only=numeric_only
)
Expand Down
Loading