Skip to content

Instantly share code, notes, and snippets.

@maximtrp
Created October 26, 2020 16:42
Show Gist options
  • Save maximtrp/4c3ee77cc40f3aba634c1649a1c8a948 to your computer and use it in GitHub Desktop.
Save maximtrp/4c3ee77cc40f3aba634c1649a1c8a948 to your computer and use it in GitHub Desktop.
Simple ECDF in Python
def ecdf(data, num=100):
y = np.linspace(0, 100, num)
x = np.percentile(data, y)
return x, y
def ecdf_plot(data, ax=None):
x, y = ecdf(data)
return ax.plot(x, y) if ax is not None else plt.plot(x, y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment