I want to add aggregation and the calculated value of that column in that same cell.
I’m taking input from dropdown for what type of aggregation i need to apply(sum, average, etc).
if data == []:
dff_avg_row = [{}]
else:
df = df if data is None else pd.DataFrame(data)
if aggregation == "sum":
dff_avg_row = df["completedDots"].sum()
elif aggregation == "average":
dff_avg_row = df["completedDots"].mean()
elif aggregation == "count":
dff_avg_row = df["completedDots"].count()
elif aggregation == "min":
dff_avg_row = df["completedDots"].min()
elif aggregation == "max":
dff_avg_row = df["completedDots"].max()
# dff_avg_row["measure_link"] = "Mean"
sum_dff = aggregation + " " + str(dff_avg_row)
print("**************************",sum_dff)
# dashGridOptions={"pinnedBottomRowData": [str(dff_avg_row)]}
dashGridOptions={"pinnedBottomRowData": [{"measure_link": aggregation,"initiative_link": "",
"completedDots": '{sum_dff}', "percent_completion":""}]}
# grid_options["pinnedBottomRowData"] = dff_avg_row
return dashGridOptions
by using this code i get NaN.
I’m want to show sum(calculated_sum) . and the want to apply diferent aggregation or diferent columns.