-
-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
ENH: DataFrame argument columns
should accept dict/iterable type
#57798
Comments
do you have this only reproduces without |
I don't have pandas-stubs. You are right, works fine with stubs. I still think this should not raise error even without stubs given that pandas-stubs describes itself as "narrower than what is possibly allowed by pandas". |
Would need to adjust Line 681 in 10f31f6
to include |
It is completely conicidential that this works and nobody should rely on it. Closing |
@Dr-Irv pandas-stubs currently declares that any |
@phofl So should we test for a |
I checked via Blame and I put that in there at some point without a test. I just tested removing |
Yes, but the typing in the pandas source is much wider than what is actually allowed by pandas. Also, type checking is faster using the stubs than using the pandas source. |
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
It is convenient to pass a dict to
columns
argument ofDataFrame
and use the same dict forastype
conversions later. The following sample code works fine, but it fails type checking:pyright output:
Feature Description
Change type annotations for columns to accept dict/iterable type.
Alternative Solutions
Convert columns value to a
Series
or numpy array or some other compatible type.Additional Context
No response
The text was updated successfully, but these errors were encountered: