Skip to content

Series.astype(object) not supported anymore #565

Closed
@tcrasset

Description

@tcrasset

Describe the bug

Series.astype(object) runs fine, and used to typecheck properly before, but since updating mypy and/or pandas-stubs, it doesn't anymore. Didn't take the time to find a working version that did not throw errors.

To Reproduce

import pandas as pd

s = pd.Series([1, 1])
s = s.astype(object)

Getting the following error message:

error: Argument 1 to "astype" of "Series" has incompatible type "Type[object]"; expected "Union[Type[bool], BooleanDtype, Type[bool_], Literal['bool', 'boolean']]"  [arg-type]
    s = s.astype(object)

Please complete the following information:

  • OS: Ubuntu 20.04.5, uname -a yields: Linux REDACTED 5.14.0-1058-oem #66-Ubuntu SMP Fri Feb 10 09:46:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

  • python version = 3.9.5

  • version of type checker: mypy=1.0.1

  • version of installed pandas-stubs: pandas_stubs=1.5.3.230304

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