diff --git a/pandas/core/strings/accessor.py b/pandas/core/strings/accessor.py index bdb88e981bcda..5cfa86f2f58ea 100644 --- a/pandas/core/strings/accessor.py +++ b/pandas/core/strings/accessor.py @@ -252,7 +252,7 @@ def _validate(data): inferred_dtype = lib.infer_dtype(values, skipna=True) if inferred_dtype not in allowed_types: - raise AttributeError("Can only use .str accessor with string values!") + raise AttributeError(f"Can only use .str accessor with string values! Inferred dType: {inferred_dtype}") return inferred_dtype def __getitem__(self, key):