Skip to content

Tag: pandas

covariance between two columns in pandas groupby pandas

I am trying to calculate the covariance between two columns by group. I am doing doing the following: Ideally, I would like to get the covariance between X and Y and not the whole variance-covariance matrix, since I only have two columns. Thank you, Answer You are almost there, only that you do not clear unde…

pandas – Merging on string columns not working (bug?)

I’m trying to do a simple merge between two dataframes. These come from two different SQL tables, where the joining keys are strings: I try to merge them using this: The result of the inner join is empty, which first prompted me that there might not be any entries in the intersection: But when I try to …