def __computeCPTraj(years: list, values: dict, n_samples: int):
    v_mean = []
    v_upper = []
    v_lower = []
    for (i, year) in enumerate(years):
        vals = [v[i] for v in values.values()]
        mean = (sum(vals) / len(vals))
        v_mean.append(mean)
        v_upper.append((max(vals) - mean))
        v_lower.append((mean - min(vals)))
    cpData = pd.DataFrame({'year': years, 'CP': v_mean, 'CP_u': v_upper, 'CP_l': v_lower})
    samples = pd.DataFrame({'year': np.linspace(years[0], years[(- 1)], n_samples)})
    dtypes = {'year': float, 'CP': float, 'CP_u': float, 'CP_l': float}
    cpData = cpData.merge(samples, how='outer').sort_values(by=['year']).astype(dtypes).interpolate()
    cpData['name'] = 'cp'
    return cpData
def __computeCPTraj(years: list, values: dict, n_samples: int):
    v_mean = []
    v_upper = []
    v_lower = []
    for (i, year) in enumerate(years):
        vals = [v[i] for v in values.values()]
        mean = (sum(vals) / len(vals))
        v_mean.append(mean)
        v_upper.append((max(vals) - mean))
        v_lower.append((mean - min(vals)))
    cpData = pd.DataFrame({'year': years, 'CP': v_mean, 'CP_u': v_upper, 'CP_l': v_lower})
    samples = pd.DataFrame({'year': np.linspace(years[0], years[(- 1)], n_samples)})
    dtypes = {'year': float, 'CP': float, 'CP_u': float, 'CP_l': float}
    cpData = cpData.merge(samples, how='outer').sort_values(by=['year']).astype(dtypes).interpolate()
    cpData['name'] = 'cp'
    return cpData