Is there a way to get all categorical variables in Pandas? The best way I know is to iterate through all columns and check whether the dtype is categorical.
Ultimately, I'd like a one-liner to plot all bar charts of all categorical variables.
Is there a way to get all categorical variables in Pandas? The best way I know is to iterate through all columns and check whether the dtype is categorical.
Ultimately, I'd like a one-liner to plot all bar charts of all categorical variables.
catCols = [col for col in df.columns if df[col].dtype=="O"]
catcols is a list will have all the columns from df whose type is O which is object