-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed as not planned
Labels
Component: PythonStatus: stale-warningIssues and PRs flagged as stale which are due to be closed if no indication otherwiseIssues and PRs flagged as stale which are due to be closed if no indication otherwiseType: enhancement
Description
We currently allow constructing a decimal array from decimal.Decimal objects or from ints:
In [14]: pa.array([1, 0], type=pa.decimal128(2))
Out[14]:
<pyarrow.lib.Decimal128Array object at 0x7f51fa2da818>
[
1,
0
]
In [31]: pa.array([decimal.Decimal('0.1'), decimal.Decimal('0.2')], pa.decimal128(2, 1))
Out[31]:
<pyarrow.lib.Decimal128Array object at 0x7fce671172b0>
[
0.1,
0.2
]but not from floats (or strings):
In [18]: pa.array([0.1, 0.2], pa.decimal128(2))
...
ArrowTypeError: int or Decimal object expected, got floatIs this something we would like to support?
There are for sure precision issues you run into, but if the decimal type is fully specified, it seems clear what the user wants. In general, since decimal objects in pandas are not that easy to work with, many people might have plain float columns that they want to convert to decimal.
Reporter: Joris Van den Bossche / @jorisvandenbossche
Related issues:
- [C++] Support lossy casts from decimal128 to float32 and float64/double (relates to)
- [C++] Implement casts from float/double to decimal128 (is related to)
Note: This issue was originally created as ARROW-5905. Please see the migration documentation for further details.
Metadata
Metadata
Assignees
Labels
Component: PythonStatus: stale-warningIssues and PRs flagged as stale which are due to be closed if no indication otherwiseIssues and PRs flagged as stale which are due to be closed if no indication otherwiseType: enhancement