Skip to content

DataFrame.reorders order parameter is incorrectly typed  #560

Closed
@aberres

Description

@aberres

The last release introduced proper typing of Axis.

This clashes with improper typing of

DataFrame.reorder_levels(self, order: Sequence[Axis], axis: Axis = 0)

order should likely be typed as Sequence[Hashable].

Snippet

import pandas as pd

df: pd.DataFrame = pd.DataFrame([0])

l = ['a', 'b']

df.reorder_levels(l)

Mypy output

axis.py:7: error: Argument 1 to "reorder_levels" of "DataFrame" has incompatible type "List[str]"; expected "Sequence[Union[Literal[0, 1], Literal['index', 'columns', 'rows']]]"  [arg-type]
    df.reorder_levels(l)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions