From a730f9c28be66e9a0ecee049c24f3a7641473d47 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Wed, 23 Dec 2020 12:19:45 -0800 Subject: [PATCH] CLN: Rolling _prep_values --- pandas/core/window/rolling.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) 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: