From 9bc6fca038dc48b6524ea075a7501c8a7e4bad3b Mon Sep 17 00:00:00 2001 From: Barbara Kemper Date: Tue, 24 Feb 2026 07:58:59 -0500 Subject: [PATCH] Fix Pandas 3.0 StringDType error Signed-off-by: Barbara Kemper --- swat/cas/datamsghandlers.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/swat/cas/datamsghandlers.py b/swat/cas/datamsghandlers.py index b1c373e4..4153cf38 100644 --- a/swat/cas/datamsghandlers.py +++ b/swat/cas/datamsghandlers.py @@ -547,7 +547,16 @@ def typemap(name, typ, dtype=dtype): elif typ == 'TIME': return (8, 'NUMERIC', 'TIME') else: - match = re.match(r'^\W?([A-Za-z])(\d*)', typ.str) + # In Pandas 3.0 the DType for Strings changed + # from Object to StringDType. + # StringDType does not have an .str attribute. + # this api check is the recommended way to + # check for a String column across Pandas versions + if pd.api.types.is_string_dtype(typ): + thetype = "S" + else: + thetype = typ.str + match = re.match(r'^\W?([A-Za-z])(\d*)', thetype) if match: out = None dtype = match.group(1)