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

DataFrame construction in row orientation fails on invalid values even with strict = False #15882

Open
2 tasks done
ruomad opened this issue Apr 25, 2024 · 0 comments
Open
2 tasks done
Labels
A-input-parsing Area: parsing input arguments bug Something isn't working P-low Priority: low python Related to Python Polars

Comments

@ruomad
Copy link

ruomad commented Apr 25, 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

pl.DataFrame([{'a': 1.0, 'b': ''}], schema = {'a': pl.Float64, 'b': pl.Float64}, orient = 'row', strict = False)
pl.DataFrame([{'a': 1.0, 'b': 'x'}], 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)
pl.DataFrame([[1.0, 'x']], 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`

or

polars.exceptions.ComputeError: could not append value: "x" of type: str to the builder; make sure that all rows have the same schema or consider increasing `infer_schema_length`

Log output

No response

Issue description

DataFrame construction from rows fails on unconvertible values even if strict = False
@stinodego: it fails even if string is not empty
It works as expected when constructing from columns

Expected behavior

Invalid values converted to null

Installed versions

--------Version info---------
Polars:               0.20.22
Index type:           UInt32
Platform:             Windows-10-10.0.19045-SP0
Python:               3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)]

----Optional dependencies----
adbc_driver_manager:  <not installed>
cloudpickle:          <not installed>
connectorx:           <not installed>
deltalake:            <not installed>
fastexcel:            0.10.4
fsspec:               <not installed>
gevent:               <not installed>
hvplot:               <not installed>
matplotlib:           <not installed>
nest_asyncio:         <not installed>
numpy:                1.26.4
openpyxl:             3.1.2
pandas:               2.2.2
pyarrow:              16.0.0
pydantic:             <not installed>
pyiceberg:            <not installed>
pyxlsb:               <not installed>
sqlalchemy:           <not installed>
xlsx2csv:             <not installed>
xlsxwriter:           <not installed>
@ruomad ruomad added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Apr 25, 2024
@ruomad ruomad changed the title DataFrame construction in row orientation fails on invalid values even with strict = True DataFrame construction in row orientation fails on invalid values even with strict = False Apr 25, 2024
@stinodego stinodego added the A-input-parsing Area: parsing input arguments label Apr 25, 2024
@stinodego stinodego added accepted Ready for implementation P-low Priority: low and removed needs triage Awaiting prioritization by a maintainer labels May 26, 2024
@stinodego stinodego removed the accepted Ready for implementation label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-input-parsing Area: parsing input arguments bug Something isn't working P-low Priority: low python Related to Python Polars
Projects
Status: Ready
Development

No branches or pull requests

2 participants