File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -727,6 +727,7 @@ Timezones
727727Numeric
728728^^^^^^^
729729- 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 `)
730731- Bug in :meth: `Series.pow ` not filling missing values correctly (:issue: `55512 `)
731732
732733Conversion
Original file line number Diff line number Diff line change @@ -114,7 +114,12 @@ def cast_for_truediv(
114114 if pa .types .is_integer (arrow_array .type ) and pa .types .is_integer (
115115 pa_object .type
116116 ):
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 )
118123 return arrow_array
119124
120125 def floordiv_compat (
Original file line number Diff line number Diff line change @@ -3133,6 +3133,14 @@ def test_arrow_floordiv():
31333133 tm .assert_series_equal (result , expected )
31343134
31353135
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+
31363144def test_string_to_datetime_parsing_cast ():
31373145 # GH 56266
31383146 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