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

Incorrect signature for pandas.Series.str.rsplit #1032

Open
kroche98 opened this issue Nov 14, 2024 · 1 comment
Open

Incorrect signature for pandas.Series.str.rsplit #1032

kroche98 opened this issue Nov 14, 2024 · 1 comment
Labels
good first issue Strings String extension data type and string data

Comments

@kroche98
Copy link

Describe the bug
The stubs for pandas_stubs.core.strings.StringMethods.rsplit includes a regex: bool parameter. The function pandas.Series.str.rsplit contains no such parameter.

To Reproduce


ser = pd.Series(["foo.bar.baz", "qux.foobar"])
ser.str.rsplit(".", regex=False)

I'm using pyright, which does not raise any error, even though it should since actually running the code results in TypeError: StringMethods.rsplit() got an unexpected keyword argument 'regex'.
Please complete the following information:

  • OS: MacOS
  • OS Version: Sonoma 14.6.1
  • Python 3.12.1
  • pyright 1.1.389
  • pandas-stubs 2.2.3.241009

Additional context
The confusion seems to stem from the fact that the parallel method pandas.Series.str.split does include a regex: bool parameter.

@loicdiridollou loicdiridollou added Strings String extension data type and string data good first issue labels Nov 14, 2024
@loicdiridollou
Copy link
Contributor

Thanks for the report, indeed it seems like deleting the regex argument should fix the issue:

def rsplit(
self, pat: str = ..., *, n: int = ..., expand: bool = ..., regex: bool = ...
) -> T: ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Strings String extension data type and string data
Projects
None yet
Development

No branches or pull requests

2 participants