File tree 3 files changed +15
-1
lines changed
3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -728,6 +728,7 @@ Timezones
728
728
Numeric
729
729
^^^^^^^
730
730
- Bug in :func: `read_csv ` with ``engine="pyarrow" `` causing rounding errors for large integers (:issue: `52505 `)
731
+ - Bug in :meth: `Series.__floordiv__ ` for :class: `ArrowDtype ` with integral dtypes raising for large values (:issue: `56645 `)
731
732
- Bug in :meth: `Series.pow ` not filling missing values correctly (:issue: `55512 `)
732
733
733
734
Conversion
Original file line number Diff line number Diff line change @@ -115,7 +115,12 @@ def cast_for_truediv(
115
115
if pa .types .is_integer (arrow_array .type ) and pa .types .is_integer (
116
116
pa_object .type
117
117
):
118
- return arrow_array .cast (pa .float64 ())
118
+ # https://github.com/apache/arrow/issues/35563
119
+ # Arrow does not allow safe casting large integral values to float64.
120
+ # Intentionally not using arrow_array.cast because it could be a scalar
121
+ # value in reflected case, and safe=False only added to
122
+ # scalar cast in pyarrow 13.
123
+ return pc .cast (arrow_array , pa .float64 (), safe = False )
119
124
return arrow_array
120
125
121
126
def floordiv_compat (
Original file line number Diff line number Diff line change @@ -3238,6 +3238,14 @@ def test_arrow_floordiv():
3238
3238
tm .assert_series_equal (result , expected )
3239
3239
3240
3240
3241
+ def test_arrow_floordiv_large_values ():
3242
+ # GH 55561
3243
+ a = pd .Series ([1425801600000000000 ], dtype = "int64[pyarrow]" )
3244
+ expected = pd .Series ([1425801600000 ], dtype = "int64[pyarrow]" )
3245
+ result = a // 1_000_000
3246
+ tm .assert_series_equal (result , expected )
3247
+
3248
+
3241
3249
def test_string_to_datetime_parsing_cast ():
3242
3250
# GH 56266
3243
3251
string_dates = ["2020-01-01 04:30:00" , "2020-01-02 00:00:00" , "2020-01-03 00:00:00" ]
You can’t perform that action at this time.
0 commit comments