Skip to content

pd.Series[Any].to_numpy returns datetime numpy array in pyright #1388

@Jeremiah-England

Description

@Jeremiah-England

Describe the bug

Pyright is using an unintended to_numpy override which is returning a datetime numpy array for general pd.Series[Any] objects.

To Reproduce

Check this with pyright.

from typing import reveal_type
import pandas as pd

reveal_type(pd.Series().to_numpy())
# Type of "pd.Series().to_numpy()" is "ndarray[tuple[int], dtype[datetime64[date | int | None]]]"

Please complete the following information:

  • OS: ArchLinux
  • Python 3.13.4
  • Pyright: v1.1.405
  • pandas-stubs=2.3.2.250926

Additional context

I'm guessing this was introduced in 7ac98f2, but I haven't check that thoroughly.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions