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?
CodePudding user response:
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.
CodePudding user response:
df.hist(column=["Category 1", "Category 2", "Category 3", "Category 4", "Category 5"])
Try using this.