Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pandas has its own typing since 2.0 #5102

Closed
davetapley opened this issue Nov 10, 2023 · 3 comments
Closed

pandas has its own typing since 2.0 #5102

davetapley opened this issue Nov 10, 2023 · 3 comments
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@davetapley
Copy link

davetapley commented Nov 10, 2023

Environment data

  • Language Server version: v2023.11.10
  • OS and version: Codespace mcr.microsoft.com/devcontainers/universal:2
  • Python version (& distribution if applicable, e.g. Anaconda): ghcr.io/devcontainers/features/python:1 on 3.11

Code Snippet

from datetime import datetime
from pandas import Timestamp

Timestamp(datetime.now().isoformat()).as_unit('us')

Repro Steps

  1. pip install pandas==2.1.0
  2. paste above snippet

Expected behavior

Type check ok because as_unit

Actual behavior

Cannot access member "as_unit" for type "Timestamp"
  Member "as_unit" is unknownPylance[reportGeneralTypeIssues](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportGeneralTypeIssues)

because as_unit not in the pandas-stubs.

because:

But this raises the question: Do we need to use pandas-stubs now 2.0 has its own types?

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Nov 10, 2023
@debonte
Copy link
Contributor

debonte commented Nov 10, 2023

This seems like a question for the folks at https://github.com/pandas-dev/pandas-stubs. If pandas has sufficient inline types to eliminate the need for stubs, then they should ship with a py.typed file. The presence of that file would cause type checkers to favor the inline types over any available stubs.

@davetapley
Copy link
Author

@debonte oh, I naively assumed it was py.typed, but apparently not 😑

It looks like as of Feb they were recommending pandas-stubs, I'll ask there...

@davetapley davetapley closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

3 participants