import pandas as pd from pandas.api.types import is_string_dtype print(f"pandas {pd.__version__}") names = pd.Series(["Ada", "Lin", None], name="name") mixed_probe = pd.Series(["Ada", 2.5], dtype="object", name="mixed") print(f"inferred dtype: {names.dtype}") print(f"object dtype check: {names.dtype == 'object'}") print(f"string column check: {is_string_dtype(names)}") print(f"mixed object check: {is_string_dtype(mixed_probe)}") print(f"missing value is None: {names.iloc[2] is None}") print(f"missing value is NA: {pd.isna(names.iloc[2])}") print(f"str accessor result: {names.str.upper().tolist()}") try: names.iloc[1] = 2.5 except TypeError as exc: print(f"non-string write: {exc}") mixed = names.astype("object") mixed.iloc[1] = 2.5 print(f"mixed opt-out dtype: {mixed.dtype}") print(f"mixed opt-out value: {mixed.iloc[1]}") print(f"values object: {type(names.values).__name__}") print(f"numpy object: {type(names.to_numpy()).__name__}")