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

Multipling a Decimal by Int returns Int type #16035

Closed
2 tasks done
philippspengler opened this issue May 3, 2024 · 2 comments · Fixed by #16046
Closed
2 tasks done

Multipling a Decimal by Int returns Int type #16035

philippspengler opened this issue May 3, 2024 · 2 comments · Fixed by #16046
Assignees
Labels
A-dtype-decimal Area: decimal data type accepted Ready for implementation bug Something isn't working P-medium Priority: medium python Related to Python Polars regression Issue introduced by a new release

Comments

@philippspengler
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

pl.DataFrame([0.12345678]).select(pl.col('column_0').cast(pl.Decimal(scale=6)) * 1)

Log output

shape: (1, 1)
┌──────────┐
│ column_0 │
│ ---      │
│ i32      │
╞══════════╡
│ 0        │
└──────────┘

Issue description

In previous versions of polars (<0.20.23), multiplying a Decimal type column with an integer resulted in a Decimal column. Since polars 0.20.23, polars converts the column to int type.

Expected behavior

shape: (1, 1)
┌────────────────┐
│ column_0 │
│ --- │
│ decimal[*,12] │
╞════════════════╡
│ 0.123456000000 │
└────────────────┘

Installed versions

--------Version info---------
Polars:               0.20.23
Index type:           UInt32
Platform:             Linux-5.11.0-46-generic-x86_64-with-glibc2.31
Python:               3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0]

----Optional dependencies----
adbc_driver_manager:  <not installed>
cloudpickle:          <not installed>
connectorx:           <not installed>
deltalake:            <not installed>
fastexcel:            <not installed>
fsspec:               2024.3.1
gevent:               <not installed>
hvplot:               <not installed>
matplotlib:           3.8.4
nest_asyncio:         1.6.0
numpy:                1.23.0
openpyxl:             <not installed>
pandas:               2.1.1
pyarrow:              15.0.2
pydantic:             <not installed>
pyiceberg:            <not installed>
pyxlsb:               <not installed>
sqlalchemy:           1.4.52
xlsx2csv:             <not installed>
xlsxwriter:           <not installed>
@philippspengler philippspengler added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels May 3, 2024
@deanm0000 deanm0000 added regression Issue introduced by a new release A-dtype-decimal Area: decimal data type P-medium Priority: medium and removed needs triage Awaiting prioritization by a maintainer labels May 3, 2024
@github-project-automation github-project-automation bot moved this to Ready in Backlog May 3, 2024
@deanm0000
Copy link
Collaborator

@ritchie46 any chance it's from #15879?

@ritchie46
Copy link
Member

Ah, yes.. That's related. Will take a look.

@github-project-automation github-project-automation bot moved this from Ready to Done in Backlog May 4, 2024
@c-peters c-peters added the accepted Ready for implementation label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dtype-decimal Area: decimal data type accepted Ready for implementation bug Something isn't working P-medium Priority: medium python Related to Python Polars regression Issue introduced by a new release
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants