Skip to content

Conversation

@samwaterbury
Copy link

@samwaterbury samwaterbury commented Jul 17, 2018

This adds a method argument to DataFrame.corrwith() which calls the corresponding correlation function which already exists within pandas. The default option "pearson" was originally implemented directly in this method, I changed it to match the other options for consistency (and a slight speed improvement).

@gfyoung gfyoung added Enhancement Apply Apply, Aggregate, Transform, Map labels Jul 17, 2018
return self._constructor(baseCov, index=idx, columns=cols)

def corrwith(self, other, axis=0, drop=False):
def corrwith(self, other, axis=0, method='pearson', drop=False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm...it would be safest to add it to the end of the signature, as this modification as it stands is not backwards compatible. Alternatively, you could issue a DeprecationWarning if a boolean is passed to method and re-assign it to drop.

@mroeschke
Copy link
Member

The default option "pearson" was originally implemented directly in this method, I changed it to match the other options for consistency (and a slight speed improvement)

Could you demonstrate this speed improvement with the ASV? I am a little dubious that the iterative method is more performant than the existing implementation.

@samwaterbury samwaterbury deleted the corrwith-changes branch August 5, 2018 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Apply Apply, Aggregate, Transform, Map Enhancement

3 participants