(df, column)
| 34 | |
| 35 | |
| 36 | def cdf(df, column): |
| 37 | df['density'] = 1 / df.shape[0] |
| 38 | df = df.groupby(column).sum(numeric_only=True) |
| 39 | |
| 40 | res = df['density'].cumsum() |
| 41 | |
| 42 | # make sure CDF starts from zero |
| 43 | index = res.index[0] |
| 44 | if index > 0: |
| 45 | res[index] = 0.0 |
| 46 | |
| 47 | return res |
| 48 | |
| 49 | |
| 50 | def getCurve(path, idx=0): |
no outgoing calls
no test coverage detected