ENH: Pairwise method or symmetric keyword in DataFrame.corr #44671
Labels
Closing Candidate
May be closeable, needs more eyeballs
Enhancement
Needs Triage
Issue that has not been reviewed by a pandas team member
Is your feature request related to a problem?
I wish I could use pandas to do pairwise computations.
Describe the solution you'd like
The
DataFrame.corr
method accepts a callable to compute a user-specified correlation function. Its docstring says:I'd like to compute pairwise calculations which are not symmetric. I can think of two possible solutions:
symmetric
keyword-only argument, changing the signature to:It keeps the current behaviour by default, but allows asymmetric callables to be computed. It could also change the behaviour when computing the diagonals, which are now set to 1, independently of the function provided.
API breaking implications
The first option shouldn't change the API, as it is adding a keyword-only argument which keeps current behaviour as default.
The second option might not be backwards-compatible with code where columns are named
pairwise
and called via attribute access.Additional context
A similar issue was raised here: #25726
The text was updated successfully, but these errors were encountered: