From 65dde9f364b943a3dd09bf497109a9dac4cd378d Mon Sep 17 00:00:00 2001 From: HeoHeo Date: Mon, 23 Jun 2025 01:25:36 +0900 Subject: [PATCH] Update cast.py --- pandas/core/dtypes/cast.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pandas/core/dtypes/cast.py b/pandas/core/dtypes/cast.py index dae04ba6244d4..d2b48dd3bfdd0 100644 --- a/pandas/core/dtypes/cast.py +++ b/pandas/core/dtypes/cast.py @@ -1060,7 +1060,7 @@ def convert_dtypes( elif ( infer_objects and input_array.dtype == object - and (isinstance(inferred_dtype, str) and inferred_dtype == "integer") + and inferred_dtype == "integer" ): inferred_dtype = target_int_dtype @@ -1086,17 +1086,14 @@ def convert_dtypes( elif ( infer_objects and input_array.dtype == object - and ( - isinstance(inferred_dtype, str) - and inferred_dtype == "mixed-integer-float" - ) + and inferred_dtype == "mixed-integer-float" ): inferred_dtype = pandas_dtype_func("Float64") if convert_boolean: if input_array.dtype.kind == "b": inferred_dtype = pandas_dtype_func("boolean") - elif isinstance(inferred_dtype, str) and inferred_dtype == "boolean": + elif inferred_dtype == "boolean": inferred_dtype = pandas_dtype_func("boolean") if isinstance(inferred_dtype, str):