Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to check mix types in pandas column

if mixed_dtypes := {c: dtype for c in df.columns if (dtype := pd.api.types.infer_dtype(df[c])).startswith("mixed")}:
    raise TypeError(f"Dataframe has one more mixed dtypes: {mixed_dtypes}")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #mix #types #pandas #column
ADD COMMENT
Topic
Name
1+9 =