-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix(python): Propagate strictness in from_dicts
#15344
Conversation
let val = match d.get_item(k)? { | ||
None => AnyValue::Null, | ||
Some(val) => val.extract::<Wrap<AnyValue>>()?.0, | ||
Some(val) => py_object_to_any_value(val, strict)?, |
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.
This was the key to the issue - calling extract
on Wrap<AnyValue>
defaults to strict.
Hello, it doesn't seem to have fully fixed this problem, I still get errors either with PyDataFrame.from_dict or PyDataFrame.from_rows. |
To be complete it does not throw the same error than with strict = True (in column orientation) but a more cryptic could not append value: "" of type: str to the builder; make sure that all rows have the same schema or consider increasing `infer_schema_length` |
@ruomad Could you give a code example? |
pl.DataFrame([{'a': 1.0, 'b': ''}], schema = {'a': pl.Float64, 'b': pl.Float64}, orient = 'row', strict = False) pl.DataFrame([[1.0, '']], schema = {'a': pl.Float64, 'b': pl.Float64}, orient = 'row', strict = False) both yield : polars.exceptions.ComputeError: could not append value: "" of type: str to the builder; make sure that all rows have the same schema or consider increasing `infer_schema_length` |
@ruomad right, so this has to do with empty strings probably. Could you open an issue and tag me please? |
Done |
Closes #15245
Includes some minor refactoring.