Ejemplo n.º 1
0
              "values.")

scalar_names = ', '.join(df["name"].unique())

confidence_level_str = props[
    "confidence_level"] if "confidence_level" in props else "none"

if confidence_level_str == "none":
    df = pd.pivot_table(df,
                        values="value",
                        columns=iso_itervars,
                        index=xaxis_itervar)
    errors_df = None
else:
    confidence_level = float(confidence_level_str[:-1]) / 100
    conf_int = lambda values: utils.confidence_interval(
        confidence_level, values) if len(values) > 1 else math.nan

    pivoted = pd.pivot_table(df,
                             values="value",
                             columns=iso_itervars,
                             index=xaxis_itervar if xaxis_itervar else "name",
                             aggfunc=[np.mean, conf_int],
                             dropna=False)
    df = pivoted["mean"]
    errors_df = pivoted["<lambda>"]

legend_cols, _ = utils.extract_label_columns(df)

p = plot if chart.is_native_chart() else plt

try:
 def conf_intv(values):
     return utils.confidence_interval(confidence_level, values)