Skip to content

Commit 138cdf8

Browse files
fangchenliclaude
andcommitted
CLN: remove unnecessary float64 cast in _dt_total_seconds
PyArrow automatically promotes int64 to double when multiplying with float. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent f20b03d commit 138cdf8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pandas/core/arrays/arrow/array.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2916,12 +2916,10 @@ def _dt_to_pytimedelta(self) -> np.ndarray:
29162916

29172917
def _dt_total_seconds(self) -> Self:
29182918
# Convert duration to seconds using PyArrow compute
2919-
# Must cast to int64 first since duration -> float64 is not supported
29202919
unit = self._pa_array.type.unit
29212920
unit_to_seconds = {"s": 1.0, "ms": 1e-3, "us": 1e-6, "ns": 1e-9}
29222921
factor = unit_to_seconds[unit]
2923-
float_arr = pc.cast(pc.cast(self._pa_array, pa.int64()), pa.float64())
2924-
result = pc.multiply(float_arr, factor)
2922+
result = pc.multiply(pc.cast(self._pa_array, pa.int64()), factor)
29252923
return self._from_pyarrow_array(result)
29262924

29272925
def _dt_as_unit(self, unit: str) -> Self:

0 commit comments

Comments
 (0)