Reputation: 31
I can't seem to get my bar graph plotted and there is no error message.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
df = pd.read_csv('report.csv')
df['Income'] = df['Income'].astype(int)
avgincome = df.groupby('Education')['Income'].mean()
eduyear = avgincome.index
plt.figure(figsize=(10,6))
plt.style.use('tableau-colorblind10')
plt.barh( eduyear,avgincome, align='center')
plt.title('Average Income by Years of Education', fontsize = 20)
plt.xlabel('Years', fontsize = 15)
plt.ylabel('Avg Income', fontsize = 15)
plt.xlim(left=0,right=25)
plt.ylim(bottom=0,top=90000)
fig.tight_layout()
plt.show()
This is the output I got. I managed to get the chart without the bars. Does anyone know what went wrong with my code? https://drive.google.com/file/d/1kZ-0qtexzdRtfRenWiYBk3N1a8keyIdF/view?usp=sharing
Upvotes: 0
Views: 928