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

Decimals in DataFrame() with orient="row" result in nulls #21537

Open
2 tasks done
ElisabethBrockhausQC opened this issue Feb 28, 2025 · 0 comments
Open
2 tasks done

Decimals in DataFrame() with orient="row" result in nulls #21537

ElisabethBrockhausQC opened this issue Feb 28, 2025 · 0 comments
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@ElisabethBrockhausQC
Copy link

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

print(
    pl.DataFrame(
        schema={"a": pl.Int64, "b": pl.Decimal(scale=2)},
        data=[
            (1, 1.0),
            (2, 2.0),
            (3, 3.0),
        ],
        orient="row",
    )
)
# output:
# shape: (3, 2)
# ┌─────┬──────────────┐
# │ a   ┆ b            │
# │ --- ┆ ---          │
# │ i64 ┆ decimal[*,2] │
# ╞═════╪══════════════╡
# │ 1   ┆ null         │
# │ 2   ┆ null         │
# │ 3   ┆ null         │
# └─────┴──────────────┘

Log output

Issue description

When using the pl.Decimal() dtype in the schema of a DataFrame with orient="row", the column contains only null values.

Expected behavior

In the given example, the DataFrame should look like

# shape: (3, 2)
# ┌─────┬──────────────┐
# │ a   ┆ b            │
# │ --- ┆ ---          │
# │ i64 ┆ decimal[*,2] │
# ╞═════╪══════════════╡
# │ 1   ┆ 1.00         │
# │ 2   ┆ 2.00         │
# │ 3   ┆ 3.00         │
# └─────┴──────────────┘

Installed versions

--------Version info---------
Polars:              1.23.0
Index type:          UInt32
Platform:            macOS-15.3.1-arm64-arm-64bit
Python:              3.12.8 | packaged by conda-forge | (main, Dec  5 2024, 14:19:53) [Clang 18.1.8 ]
LTS CPU:             False

----Optional dependencies----
Azure CLI            <not installed>
adbc_driver_manager  <not installed>
altair               5.5.0
azure.identity       <not installed>
boto3                1.36.14
cloudpickle          3.1.1
connectorx           <not installed>
deltalake            <not installed>
fastexcel            <not installed>
fsspec               2025.2.0
gevent               <not installed>
google.auth          2.38.0
great_tables         <not installed>
matplotlib           <not installed>
numpy                <not installed>
openpyxl             3.1.5
pandas               <not installed>
polars_cloud         <not installed>
pyarrow              <not installed>
pydantic             2.10.6
pyiceberg            <not installed>
sqlalchemy           2.0.38
torch                <not installed>
xlsx2csv             <not installed>
xlsxwriter           3.2.2```

</details>
@ElisabethBrockhausQC ElisabethBrockhausQC added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Feb 28, 2025
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