Skip to content

Groupby filter doesn't work with repeated index #4620

Closed
@hayd

Description

@hayd

Example:

In [1]: data = pandas.DataFrame(
    {'pid' : [1,1,1,2,2,3,3,3],
     'tag' : [23,45,62,24,45,34,25,62],
     }, index=[0] * 8)

In [2]: g = data.groupby('tag')

In [3]: g.filter(lambda x: len(x) > 1)
Exception: Reindexing only valid with uniquely valued Index objects

cc #3680

(I had thought there was also a similar behaviour with transform, but that seems ok.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions