Reputation: 71
I am trying to plot integer columns of dataframe. I am trying by following way
for i in df:
if df[i].dtypes == 'int64':
df[i].plot.kde()
But it is plotting all in the same graph. I am new to it and would like to know how can I do it?
Upvotes: 2
Views: 417
Reputation: 7206
If I understand correctly, you need :
df[(df.dtypes == 'int64').index].plot.kde(subplots=True)
#we find the columns that have int64 values and plot all columns in different plot
Using your code : using above code
Upvotes: 0
Reputation: 474
Just try to add plot option in your loop:
for i in df:
if df[i].dtypes == 'int64':
df[i].plot.kde()
plt.show()
Upvotes: 1