I tried to make pie chart with plotting process.
chad = pd.read_csv("Admission_Predict.csv", engine = 'python')
chad_2 = chad.drop(['Serial No'], axis = 1)
chad_2.head()
This shows the picture below:
f, ax = plt.subplots(1, 2, figsize=(18,8))
chad_2['Chance of Admit'].value_counts().plot.pie(explode =[0,0.1], labels = ['low', 'high'], colors = ['#0066cc', '#cc0000'], autopct='%1.1f%%', ax=ax[0], textprops = {'fontsize' : 40})
ax[0].set_title('Pie plot - Chance of Admit')
ax[0].set_ylabel('')
sns.countplot('Chance of Admit', data=chad_2, ax=ax[1], palette = "Set1")
ax[`1`].set_xticklabels(["low", "high"])
ax[`1`].set_title('Count plot - Chance of Admit')
plt.show()
However, the return for this code shows error below...
I've got the answer to my question. The column had spaces at the end. So I executed chad_2.columns = chad_2.columns.str.strip() And it worked!