-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Support for Decimal series? #4104
Comments
x2 |
I am not familiar with the arrow format and the inner workings of polars but I guess that adding proper support for decimal is a significant work. In the mean time a probably easier thing to do is convert decimal with scale 0, precision 1-9 to Int32, decimal with scale 0, precision 10-19 to Int64 and in all other cases convert to Text. Polars can then read the files with decimal and do a lot of analysis with the functionality that exists for Int and Text and of course do analysis on all the other fields. |
At the least, it would be nice if import pyarrow.parquet
data = pyarrow.parquet.read_table("one_row.parquet")
data["pred_mean"].type # Decimal128Type(decimal128(38, 0))
df = pl.from_arrow(data)
df["pred_mean"].dtype # polars.datatypes.Float64
df = pl.read_parquet("one_row.parquet")
# InvalidOperationError: Cannot create polars series from Decimal(38, 0) type |
Same issue here. Please support decimal! |
I was trying out polar's new delta reader and ran into this error using pl.scan_delta(...)
I've installed polars with |
+1! |
1 similar comment
+1! |
Is there a rundown of what it would take to add decimal support to pola-rs? A previous comment mentioned this might be a large effort, but perhaps if it's broken down into manageable pieces, the community could take this on? I understand that breaking this down is also a bunch of work in itself, so I totally understand that this isn't done nor prioritized. Still, providing some guidance to new contributors might be a way to get this done at a lower bar than doing the work itself. Also, as a side-note, I would recommend making the conversion to |
Agreed with @plaflamme. I'd be happy to contribute to some of the work to support decimal type. It's the only thing keeping us from moving from pandas to polars. |
I can see of I can take some time for this in the coming weeks. |
@ritchie46 That's great news! Please note that I'd be happy to help out this effort if there's a way to break it down. I can also help testing. |
That would be great. The first step would be adding We could merge this first and then we'll have to look what the best next steps are. |
Alright, here's a draft PR, feedback would be greatly appreciated. |
I believe Polars supports Decimals since https://github.com/pola-rs/polars/releases/tag/py-0.16.10 I have added #7566 relating to the current implementation. |
In polars[all] v0.16.13 I still get the following when trying to load a parquet file with decimals in it: Arrow datatype Decimal(38, 9) not supported by Polars. You probably need to activate that data-type feature. How do I activate the feature? |
I got the same with '0.16.13' when reading with |
@martin-wiebusch-thg, @naarkhoo: pl.Config.activate_decimals() Still in early development/testing, hence the need to explicitly activate (for now). |
Now that the feature exists (in an early/development state), I'm closing this issue in favour of more specific issues/requirements found with the implementation...👍 |
Since Arrow2 provides support for the Decimal data type, is there any plan to allow it for Polars series?
The text was updated successfully, but these errors were encountered: