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

pl.Series.str.slice fails with chinese character #1669

Closed
chuchiy opened this issue Nov 3, 2021 · 2 comments · Fixed by #1681
Closed

pl.Series.str.slice fails with chinese character #1669

chuchiy opened this issue Nov 3, 2021 · 2 comments · Fixed by #1681

Comments

@chuchiy
Copy link

chuchiy commented Nov 3, 2021

Are you using Python or Rust?

python

What version of polars are you using?

0.10.15

What operating system are you using polars on?

windows

Describe your bug.

pl.Series.str.slice can not substr chinese characters

What are the steps to reproduce the behavior?

Example

df = pl.DataFrame(
    {
        "b": ["foo", "ham", "spam", "egg", "中文"],
    }
)
df[[pl.col('b').str.slice(1,1)]]

What is the actual behavior?

above code snippet will throw error

PanicException: A non-utf8 string was passed.: Utf8Error

What is the expected behavior?

slice(1, 1) should return ["o", "a", "p", "g", "文"]

@ritchie46
Copy link
Member

Thanks, for the issue report. Forgot about UTF8, will fix it!

@ritchie46
Copy link
Member

Fix upstream: jorgecarleitao/arrow2#568

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants