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

Using clear on Series of type Object results in dtype Null when first value is null #15303

Closed
2 tasks done
stinodego opened this issue Mar 26, 2024 · 0 comments · Fixed by #15315
Closed
2 tasks done
Labels
A-dtype-object Area: object data type bug Something isn't working P-low Priority: low python Related to Python Polars

Comments

@stinodego
Copy link
Member

stinodego commented Mar 26, 2024

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

import polars as pl

s = pl.Series([None, object()])
result = s.clear()
print(result)

Log output

shape: (0,)
Series: '' [null]
[
]

Issue description

Problematic code is here:

let av = self.get(0).unwrap();
Series::new(self.name(), [av]).slice(0, 0)

The first value is taken to infer the data type, while the first non-null value should be taken.

Expected behavior

Result in Series with Object data type.

Installed versions

main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dtype-object Area: object data type bug Something isn't working P-low Priority: low python Related to Python Polars
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant