Reputation: 2589
I am struggling to find an equivalent of ecdf function of R, namely
x<-1:10
y<-ecdf(x)(x)
in Python. Does exists an equivalent of this function?
Upvotes: 0
Views: 82
Reputation: 114811
Toby's suggestion to use the ECDF
class in statsmodels is great. Here's an alternative that you could use if you don't want the dependency on statsmodels, but scipy is OK:
from scipy.stats import rankdata
y = rankdata(x, method='max')/float(len(x))
Upvotes: 1
Reputation:
I believe that you're looking for this http://www.statsmodels.org/stable/generated/statsmodels.distributions.empirical_distribution.ECDF.html.
Upvotes: 3