Skip to content

DEPR: groupby.corrwith #57158

Closed
Closed
@rhshadrach

Description

@rhshadrach

As far as I can tell, corrwith was added simply because it could be along with other methods on DataFrame. Searching SO gives two results, of which corrwith is not involved in the solution for both. I'm guessing this method really doesn't see much if any use.

It's signature is odd - it pairs each of the groups up with a single DataFrame and aligns them.

df = pd.DataFrame({"a": [1, 1, 1, 2, 2, 2], "b": range(6)})
df2 = pd.DataFrame({"a": [1, 1, 1, 2, 2, 2, 3], "b": [10 - e for e in range(3)] + list(range(3)) + [10]})
gb = df.groupby("a")
print(gb.corrwith(df2))
#      b   a
# a         
# 1 -1.0 NaN
# 2  1.0 NaN

I'm thinking we should deprecate this method.

Metadata

Metadata

Labels

DeprecateFunctionality to remove in pandasGroupbyNeeds DiscussionRequires discussion from core team before further actionReduction Operationssum, mean, min, max, etc.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions