How do I create histograms for all variables except one in Python?
Save the column that you want to exclude in a variable:
exclude = ["age"]
And the plot the histogram accordingly:
df.loc[:, df.columns.difference(exclude)].hist(figsize=(15, 10));
This should solve your problem.
df.hist() gives you histograms for all variables.
df.hist(column='age') gives you a histogram for just age.
What if I want histograms for all variables except one? Do I have to do them separately? And what's the difference between using df.hist() and the Matplotlib version anyway?