diff --git a/pint_pandas/pint_array.py b/pint_pandas/pint_array.py index 2fe9652..a6507bd 100644 --- a/pint_pandas/pint_array.py +++ b/pint_pandas/pint_array.py @@ -864,15 +864,22 @@ def convert_values(param): # a TypeError should be raised res = op(lvalues, rvalues) + subdtype = self.dtype.subdtype + if "truediv" in op.__name__ and subdtype.kind == "i": + if isinstance(subdtype, _NumpyEADtype): + subdtype = "float64" + else: + subdtype = "Float64" + if op.__name__ == "divmod": return ( - cls.from_1darray_quantity(res[0], self.dtype.subdtype), - cls.from_1darray_quantity(res[1], self.dtype.subdtype), + cls.from_1darray_quantity(res[0], subdtype), + cls.from_1darray_quantity(res[1], subdtype), ) if coerce_to_dtype: try: - res = cls.from_1darray_quantity(res, self.dtype.subdtype) + res = cls.from_1darray_quantity(res, subdtype) except TypeError: pass diff --git a/pint_pandas/testsuite/test_issues.py b/pint_pandas/testsuite/test_issues.py index 98b28d2..9fde3fb 100644 --- a/pint_pandas/testsuite/test_issues.py +++ b/pint_pandas/testsuite/test_issues.py @@ -41,7 +41,7 @@ def test_force_ndarray_like(self): result = pd.concat([a, b], axis=1) expected = pd.DataFrame( - {0: PintArray(q_a_), 1: PintArray(q_b)}, dtype="pint[degC][Int64]" + {0: PintArray(q_a_), 1: PintArray(q_b)}, dtype="pint[degC][Int32]" ) tm.assert_equal(result, expected) @@ -64,7 +64,7 @@ def test_offset_concat(self): result = pd.concat([a, b], axis=1) expected = pd.DataFrame( - {0: PintArray(q_a_), 1: PintArray(q_b)}, dtype="pint[degC][Int64]" + {0: PintArray(q_a_), 1: PintArray(q_b)}, dtype="pint[degC][Int32]" ) tm.assert_equal(result, expected)