Skip to content

error: Argument 1 to "astype" of "Series" has incompatible type "dtype[generic] | ExtensionDtype"; expected "type[object] | ExtensionDtype" [arg-type] #747

Closed
@randolf-scholz

Description

@randolf-scholz

Describe the bug

Series.dtype is incompatible with Series.astype

To Reproduce

import pandas as pd

s = pd.Series([1, 2, 3])
s = s.astype(s.dtype)  # ✘ [arg-type]

Please complete the following information:

  • OS: Ubuntu 22.04
  • python version 3.10
  • mypy 1.4.1
  • pandas 2.0.3
  • pandas-stubs 2.0.2.230605

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