A great feature supported by Pandas is the data.hist()
. The hist
function allows me to visualize the distribution of numerical values. However, that being said: it only allows me to view the distribution for numerical variables.
If I wanted to view the distribution of categorical variables, I'd need to run select_dtypes
in a for loop as follows:
import matplotlib.pyplot as plt
for col in tips.select_dtypes(include=["category"]):
tips[col].value_counts().plot(kind='bar')
plt.show()
Is there an easier (more Pythonic) way to view the distribution of categorical variables.