-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
API: Return BoolArray for string ops when backed by StringArray #30239
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
Changes from 1 commit
0623200
1d9317e
efe7923
f6d9e4e
5f9dbe9
b83d677
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
from functools import wraps | ||
import re | ||
import textwrap | ||
from typing import TYPE_CHECKING, Any, Callable, Dict, List | ||
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Type, Union | ||
import warnings | ||
|
||
import numpy as np | ||
|
@@ -158,6 +158,7 @@ def _map_stringarray( | |
arr = np.asarray(arr) | ||
|
||
if is_integer_dtype(dtype) or is_bool_dtype(dtype): | ||
constructor: Union[Type[IntegerArray], Type[BooleanArray]] | ||
if is_integer_dtype(dtype): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MyPy apparently doesn't like this...
Any suggestions on how to please the type checker? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea if you have assignment in an So before the block you can just declare There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nvm, I think I got it. |
||
constructor = IntegerArray | ||
else: | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional but less verbose if you put the Union inside of the Type