Seaborn plots in a loop

You can create a new figure each loop or possibly plot on a different axis. Here is code that creates the new figure each loop. It also grabs the int and float columns more efficiently.

import matplotlib.pyplot as plt

df1 = df.select_dtypes([, np.float])
for i, col in enumerate(df1.columns):
    sns.countplot(x=col, data=df1)

Leave a Comment