Skip to content

dask.dataframe groupby cov warns with DataFrameGroupBy.apply operated on the grouping columns FutureWarning #10573

Open

Description

@graingert

running the following with pandas 2.2.0.dev0+390.g59d4e84128 (nightly)

import dask.dataframe as dd
import pandas as pd

pdf = pd.DataFrame(
    {"a": [1, 2, 6, 4, 4, 6, 4, 3, 7], "b": [4, 2, 7, 3, 3, 1, 1, 1, 2]},
    index=[0, 1, 3, 5, 6, 8, 9, 9, 9],
)
ddf = dd.from_pandas(pdf, npartitions=3)
ddf.groupby("b").a.cov().compute()

outputs the following:

/home/graingert/projects/dask/dask/dataframe/groupby.py:674: FutureWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  mul = g.apply(_mul_cols, cols=cols).reset_index(level=-1, drop=True)
/home/graingert/projects/dask/dask/dataframe/groupby.py:732: FutureWarning: The previous implementation of stack is deprecated and will be removed in a future version of pandas. See the What's New notes for pandas 2.1.0 for details. Specify future_stack=True to adopt the new implementation and silence this warning.
  s_result = result.stack(dropna=False)
/home/graingert/projects/dask/dask/dataframe/groupby.py:674: FutureWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  mul = g.apply(_mul_cols, cols=cols).reset_index(level=-1, drop=True)
/home/graingert/projects/dask/dask/dataframe/groupby.py:674: FutureWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  mul = g.apply(_mul_cols, cols=cols).reset_index(level=-1, drop=True)
/home/graingert/projects/dask/dask/dataframe/groupby.py:674: FutureWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  mul = g.apply(_mul_cols, cols=cols).reset_index(level=-1, drop=True)
/home/graingert/projects/dask/dask/dataframe/groupby.py:592: RuntimeWarning: invalid value encountered in scalar divide
  val = (df[mul_col] - df[i] * df[j] / n).values[0] / div.values[0]
/home/graingert/projects/dask/dask/dataframe/groupby.py:592: RuntimeWarning: invalid value encountered in scalar divide
  val = (df[mul_col] - df[i] * df[j] / n).values[0] / div.values[0]
/home/graingert/projects/dask/dask/dataframe/groupby.py:732: FutureWarning: The previous implementation of stack is deprecated and will be removed in a future version of pandas. See the What's New notes for pandas 2.1.0 for details. Specify future_stack=True to adopt the new implementation and silence this warning.
  s_result = result.stack(dropna=False)

Activity

  1. added
    needs triage
    on Oct 18, 2023
  2. added
    needs attention
    on Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs attentionneeds triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions