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 @@ -727,6 +727,7 @@ Timezones
727
727
Numeric
728
728
^^^^^^^
729
729
- Bug in :func: `read_csv ` with ``engine="pyarrow" `` causing rounding errors for large integers (:issue: `52505 `)
730
+ - Bug in :meth: `Series.__floordiv__ ` for :class: `ArrowDtype ` with integral dtypes raising for large values (:issue: `56645 `)
730
731
- Bug in :meth: `Series.pow ` not filling missing values correctly (:issue: `55512 `)
731
732
732
733
Conversion
Original file line number Diff line number Diff line change @@ -114,7 +114,12 @@ def cast_for_truediv(
114
114
if pa .types .is_integer (arrow_array .type ) and pa .types .is_integer (
115
115
pa_object .type
116
116
):
117
- return arrow_array .cast (pa .float64 ())
117
+ # https://github.com/apache/arrow/issues/35563
118
+ # Arrow does not allow safe casting large integral values to float64.
119
+ # Intentionally not using arrow_array.cast because it could be a scalar
120
+ # value in reflected case, and safe=False only added to
121
+ # scalar cast in pyarrow 13.
122
+ return pc .cast (arrow_array , pa .float64 (), safe = False )
118
123
return arrow_array
119
124
120
125
def floordiv_compat (
Original file line number Diff line number Diff line change @@ -3133,6 +3133,14 @@ def test_arrow_floordiv():
3133
3133
tm .assert_series_equal (result , expected )
3134
3134
3135
3135
3136
+ def test_arrow_floordiv_large_values ():
3137
+ # GH 55561
3138
+ a = pd .Series ([1425801600000000000 ], dtype = "int64[pyarrow]" )
3139
+ expected = pd .Series ([1425801600000 ], dtype = "int64[pyarrow]" )
3140
+ result = a // 1_000_000
3141
+ tm .assert_series_equal (result , expected )
3142
+
3143
+
3136
3144
def test_string_to_datetime_parsing_cast ():
3137
3145
# GH 56266
3138
3146
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