Skip to content

Instantly share code, notes, and snippets.

@ishritam
Last active October 9, 2019 11:00
Show Gist options
  • Save ishritam/0e1a9a9aadb350d88f45f2cb05b51fba to your computer and use it in GitHub Desktop.
Save ishritam/0e1a9a9aadb350d88f45f2cb05b51fba to your computer and use it in GitHub Desktop.
Plot CDF of petal_length
#Plot CDF of petal_length
counts, bin_edges = np.histogram(iris_setosa['petal_length'], bins=10,
density = True)
pdf = counts/(sum(counts))
print(pdf);
print(bin_edges)
#compute CDF
cdf = np.cumsum(pdf)
plt.plot(bin_edges[1:],pdf)
plt.plot(bin_edges[1:], cdf)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment