Mistake in viz.compute_cdf()?
- Dominant language
- Python
- Stars
- 0
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
I think there is a small error in the way the cdf is computed. I think it should be like this.
def compute_cdf(pdf):
"""Compute the cumulative distribution function (cdf) given a pdf."""
values = np.array([np.trapz(pdf.iloc[:x**+1**], pdf.index[:x**+1**]) for x in range(pdf.size)])
cdf = pd.Series(values, index=pdf.index.values)
return cdf
Before the first two values were 0, because when x=0 there are no points in pdf.iloc[:0] and the integral over one point pdf.iloc[:1] is 0 and the last points wasn't evaluated. This should be changed in future versions of pyam.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.