Skip to content

df.groupby on a column with complex numbers is broken #26475

Closed
@basnijholt

Description

@basnijholt

Currently, grouping by a key that has complex numbers is broken, see the following example

import pandas as pd
df = pd.DataFrame([dict(a=1, b=1 + 1j), dict(a=1, b=1 + 2j)])
df.groupby("b").groups

output:

{1.0: Int64Index([0, 1], dtype='int64')}

expected:

{0: Int64Index([0], dtype='int64'), 1: Int64Index([1], dtype='int64')}

Related #10921

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions