how to convert a dataframe of counts to a probability density function
IIUC, statsmodels
lets you fit a weighted KDE:
from statsmodels.nonparametric.kde import KDEUnivariate
df = pd.DataFrame({'observed_scores': [100, 95, 90, 85],
'counts': [1534, 1399, 3421, 8764]})
kde1= KDEUnivariate(df.observed_scores)
kde_noweight = KDEUnivariate(df.observed_scores)
kde1.fit(weights=df.counts, fft=False)
kde_noweight.fit()
plt.plot(kde1.support, kde1.density)
plt.plot(kde_noweight.support, kde_noweight.density)
plt.legend(['weighted', 'unweighted'])