Dec-14-2022, 05:55 AM
Hi
Currently, I ran the below code in Spyder. And I only see the last plot (Age) in my "Plots" window. How can I see the plot for each column as the code loops through the columns?
Thank you
Currently, I ran the below code in Spyder. And I only see the last plot (Age) in my "Plots" window. How can I see the plot for each column as the code loops through the columns?
Thank you
import pandas as pd
import seaborn as sns
df=pd.DataFrame ({'Sex': ['M', 'M', 'F'],
'Age': ['19', '88','14']
})
for col in df.columns:
c=df.groupby(col)[col].count()
sns.barplot(x=c.index,y=c.values)
