Using a dict in schema
parameter in LazyFrame constructor implicitly sets expected row order
#21659
Labels
documentation
Improvements or additions to documentation
Description
Wording in documentation does not make this behavior clear.
Dictionaries of course have been an explicitly ordered iterable for a while in Python, but it is not their primary use. I tried to read a file supplying pre-defined schema, and caught dtype conversion errors because columns I specified were encountered in the wrong order. Using
schema_overrides
with the same input argument instead worked as expected.I agree with this behavior, but error messages are very unhelpful:
The
schema
parameter needs to be documented as specifying the order in addition to datatypes.Alternatively, implicit schema reordering could be enabled via another flag parameter, but since
schema_overrides
exists for use-case of loosely structured data, it may not be as important.Use cases it would help:
Link
https://docs.pola.rs/api/python/stable/reference/lazyframe/index.html
The text was updated successfully, but these errors were encountered: