Skip to content

BUG: .str.split() method of pandas.Series behaves strangely #44157

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

Closed
2 of 3 tasks
oltip opened this issue Oct 23, 2021 · 1 comment
Closed
2 of 3 tasks

BUG: .str.split() method of pandas.Series behaves strangely #44157

oltip opened this issue Oct 23, 2021 · 1 comment
Labels
API - Consistency Internal Consistency of API/Behavior Bug Duplicate Report Duplicate issue or pull request Strings String extension data type and string data

Comments

@oltip
Copy link

oltip commented Oct 23, 2021

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the master branch of pandas.

Reproducible Example

import pandas as pd 

series = pd.Series(['bae systems (international) ltd']) 

series.str.split('a. s.')  
# returns 
0    [b, stems (international) ltd]

Issue Description

The .str.split() method of Pandas Series does not split items as expected.

Expected Behavior

The .str method of Pandas Series does not split items as expected.

s = "bae systems (international) ltd"
s.split('a. s.')

# should return
['bae systems (international) ltd']

Installed Versions

pandas 1.3.0

@oltip oltip added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 23, 2021
@mzeitlin11
Copy link
Member

Thanks @oltip for the report. Going to close as a duplicate of #43563 - the problem is that an argument of length > 1 is interpreted as a regex. So escaping the periods would be one potential workaround

@mzeitlin11 mzeitlin11 added API - Consistency Internal Consistency of API/Behavior Duplicate Report Duplicate issue or pull request Strings String extension data type and string data and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 23, 2021
@mzeitlin11 mzeitlin11 added this to the No action milestone Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Bug Duplicate Report Duplicate issue or pull request Strings String extension data type and string data
Projects
None yet
Development

No branches or pull requests

2 participants