fix: DataFrame.assign None #1238
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
- [ ] Closes #xxxx (Replace xxxx with the Github issue number)assert_type()
to assert the type of any return valueDescribe the bug
Assigning a
None
column usingDataFrame.assign
causes a typing error.To Reproduce
Provide a minimal runnable
pandas
example that is not properly checked by the stubs.Indicate which type checker you are using (
mypy
orpyright
).mypy
Show the error message received from that type checker while checking your example.
Please complete the following information
OS
Windows
OS Version
10
python version
3.13.2
version of type checker
1.16.0
version of installed
pandas-stubs
2.2.3.250527