I have data from different age groups that I am trying to plot as a histogram. I have binned the age groups. When I plot my graph as a bar or line graph my data looks good but when I try to plot as a histogram the graph is wrong. What am I doing wrong?
Binning and saving:
df = pd.read_csv('test.csv')
age_groups = pd.cut(df['Age'], bins=[0, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80,np.inf])
Cedar = df.groupby(age_groups)['Cedar'].mean()
Cedar = pd.DataFrame(Cedar, index = None)
Cedar.to_csv('Cedar.csv')
plotting the graph:
Cedar = pd.read_csv('Cedar.csv')
plt.figure();
Cedar.plot(x = 'Age', 
           y = 'Cedar', 
           kind = 'hist', 
           logy = False, 
           figsize = [15,10], 
           fontsize = 15);
 
    