What does `groupby` use to determine equality?

dataframes

#1

I have a dataframe with some custom types in one of the columns I’d like to groupby. This doesn’t seem to work correctly as the groupby seems to consider objects that are == and have identical hash to be distinct. What function does groupby use to decide whether elements are distinct?

I’m sure I’ll find it in the source code eventually, but haven’t so far…


#2

Is uses hash and isequal. Do you have an example?


#3

That’s what I thought… hmm, this is really weird, I did a little hack where I grouped by a column of hash instead and that works fine… sounds like those should be equivalent. Might be a bug, I’ll try to get a MWE when I get a chance, thanks.


#4

Did you try reindexing by the columns you wish to groupby first?