Skip to content

Instantly share code, notes, and snippets.

@jackvial
Last active October 8, 2017 00:41
Show Gist options
  • Save jackvial/e0bf3532e3b80fab0d64696601f2437c to your computer and use it in GitHub Desktop.
Save jackvial/e0bf3532e3b80fab0d64696601f2437c to your computer and use it in GitHub Desktop.
Python ECDF
def ecdf(data):
"""Compute ECDF for a one-dimensional array of measurements."""
# Number of data points: n
n = len(data)
# x-data for the ECDF: x
x = np.sort(data)
# y-data for the ECDF: y
y = np.arange(1, n+1) / n
return x, y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment