diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 43d09fbaace3b..426107c7c6b60 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -32,9 +32,7 @@ from pandas.core.dtypes.common import ( ensure_float64, is_bool, - is_float_dtype, is_integer, - is_integer_dtype, is_list_like, is_scalar, needs_i8_conversion, @@ -263,18 +261,14 @@ def _prep_values(self, values: Optional[np.ndarray] = None) -> np.ndarray: if values is None: values = extract_array(self._selected_obj, extract_numpy=True) - # GH #12373 : rolling functions error on float32 data - # make sure the data is coerced to float64 - if is_float_dtype(values.dtype): - values = ensure_float64(values) - elif is_integer_dtype(values.dtype): - values = ensure_float64(values) - elif needs_i8_conversion(values.dtype): + if needs_i8_conversion(values.dtype): raise NotImplementedError( f"ops for {self._window_type} for this " f"dtype {values.dtype} are not implemented" ) else: + # GH #12373 : rolling functions error on float32 data + # make sure the data is coerced to float64 try: values = ensure_float64(values) except (ValueError, TypeError) as err: