'Plot a Gaussian Distribution over a Histogram

I am trying to fit a Gaussian Distribution over a histogram for a project.

I have read a csv file and produced a pandas data frame.

I have produced the histogram, and I have tried a few methods to fit a distribution, however I always end up with a straight line formed at the bottom of my histogram. I think it may have something to do with the column I am trying to fit over is an Float64 but I'm not sure how to change that.

So far I have...

x=df1['rating']
plt.figure(figsize(10,10))
plt.hist(x, bins=20,color='c',edgecolor='k', alpha=0.65, linewidth=2)
plt.axvline(x.mean(), color='k', linestyle='dashed', linewidth=2,label="mean")
plt.axvline(x.median(),color='r',linestyle='dashed',linewidth=2)

Rating Histogram



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source