Open MTisMT opened 1 week ago
What's in your res
variable? Please create a reproducible example - without it, we cannot do much.
I can say that you should probably be using read_database
or read_database_uri
for this, rather than reading stuff into a cursor and plugging it into the DataFrame constructor.
I created the reproducible example in test.json
and updated the issue. The error is still there.
The problem was solved using by setting infer_schema_length
to None
, thanks to jqurious
pl.DataFrame(res, infer_schema_length=None)
It seems the error was raised because the default value of infer_schema_length
is 100. However, in our data, the type of that column can not be detected until a row is bigger than 100.
The error description only suggests increasing the infer_schema_length
. Now this error description can be modified:
make sure that all rows have the same schema or consider increasing infer_schema_length or setting infer_schema_length to None. it might also be that a value overflows the data-type's capacity
Checks
Reproducible example
test.json
Log output
Issue description
I'm encountering a ComputeError when trying to create a Polars DataFrame from a data. It seems Polars has a problem with the value
1.41431
. Pandas works fine in creating a dataframe from the same data, but I do not want to use pandas since it is slow. I've also noticed that a similar error was discussed in a closed GitHub issue for Polars, but I am still encountering this error despite using the latest version of Polars (0.20.31). I checked the types of the values in res and they seem to be consistent. I also tried other things like rounding floating-point numbers to 5 decimal places or increasinginfer_schema_length
, but they didn't work and I got the same error again. I also asked my question on Stackoverflow. Has anyone faced a similar issue or have any insights on how to resolve this?Expected behavior
I expected the pl.DataFrame(res) line to work similarly to the pd.DataFrame(res) line, but it raises the mentioned error.
Installed versions