My data has two categorical variables:
- 5 function
- 35 diploma
df = pd.DataFrame({'function': ['nurse', 'doctor', 'paediatric_nurse','kitchen_staff','surgeon'], 'diploma': ['nurse_schoolA', 'nurse_schoolB, ...'nurse_school M, doctor_schoolA'....]})
For each function, I want a graph showing a count of each diploma.
ax=sns.catplot(x='ldiploma',kind='count',data=df,orient="h", col='function')
ax.fig.autofmt_xdate()
Is there a way to limit the data shown for each function to only the diploma for which there is data in this category?
I tried the following, which results in an error message that df is not recognized
ax=sns.catplot(x='diploma',kind='count',data=df.query("df['diploma'].count()>0"),orient="h", col='function')
ax.fig.autofmt_xdate()