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

map_elements does not support dtype Decimal #19374

Open
2 tasks done
hkad98 opened this issue Oct 22, 2024 · 0 comments
Open
2 tasks done

map_elements does not support dtype Decimal #19374

hkad98 opened this issue Oct 22, 2024 · 0 comments
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@hkad98
Copy link

hkad98 commented Oct 22, 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

from decimal import Decimal
import polars as pl

df = pl.DataFrame(
        {
            "abc": [Decimal("85510.0")],
        }
    )
df.with_columns(pl.col("abc").map_elements(lambda x: x))

Log output

pyo3_runtime.PanicException: dtype Decimal(None, Some(1)) not supported

Issue description

I provided minimal reproducers, which is not a real-world example. I encountered an issue for the use case where I needed to format some columns and the function in map_elements converted and formatted values to str.

Expected behavior

map_elements should work for pl.Decimal

Installed versions

--------Version info---------
Polars:              1.10.0
Index type:          UInt32
Platform:            macOS-14.6.1-arm64-arm-64bit
Python:              3.12.4 (main, Jul  1 2024, 10:39:18) [Clang 15.0.0 (clang-1500.3.9.4)]
LTS CPU:             False

----Optional dependencies----
adbc_driver_manager  <not installed>
altair               <not installed>
cloudpickle          <not installed>
connectorx           <not installed>
deltalake            <not installed>
fastexcel            <not installed>
fsspec               <not installed>
gevent               <not installed>
great_tables         <not installed>
matplotlib           <not installed>
nest_asyncio         <not installed>
numpy                1.26.4
openpyxl             <not installed>
pandas               2.1.4
pyarrow              17.0.0
pydantic             <not installed>
pyiceberg            <not installed>
sqlalchemy           <not installed>
torch                <not installed>
xlsx2csv             <not installed>
xlsxwriter           <not installed>
@hkad98 hkad98 added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

No branches or pull requests

1 participant