-
-
Notifications
You must be signed in to change notification settings - Fork 156
GH1541 Revert Series[Any].__add__(str) #1542
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
base: main
Are you sure you want to change the base?
GH1541 Revert Series[Any].__add__(str) #1542
Conversation
pandas-stubs/core/series.pyi
Outdated
| # them up. | ||
| @overload | ||
| def __add__(self: Series[Never], other: complex | ListLike) -> Series: ... | ||
| def __add__(self: Series[Never], other: _str | complex | ListLike) -> Series: ... |
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.
Can you create an overload that says if other: _str, the result is Series[str] ?
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.
Addressed
tests/series/test_series.py
Outdated
|
|
||
|
|
||
| def test_series_add_str() -> None: | ||
| """Test Series.__add__ with Series[Any].""" | ||
| df = pd.DataFrame({0: ["a", "b"]}) | ||
| sr = df[0] | ||
|
|
||
| check(assert_type(sr + "c1", pd.Series), pd.Series, str) |
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.
Plesae move the new test to tests\series\arithmetic\test_add.py and make use of left_str.
Probably we need to make the same valid tests in tests\series\arithmetic\str\test_add.py (excluding the TYPE_CHECKING_INVALID_USAGE ones) work for Series[Any].
For consistency, we probably also need to make Index[Any] + str etc. work
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.
Addressed
Dr-Irv
left a comment
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.
I'm fine with this. Would like @cmp0xff to take a look as well.
assert_type()to assert the type of any return value)AGENTS.md.