Streamlit AG Grid aggFunc avg

I am developing an application showing a budget grid. This is grouped by a segment, and on each of these groups i would like to summarize the totals for the segment.

It works fine with aggFunc=‘sum’, but as soon as i use aggFunc=‘avg’, then it gives me this error:

Component Error

params.value.toFixed is not a function

I have no idea what I’m doing wrong …

    for column in df_columns: 
        if fnmatch.fnmatch(column, '*_annual_budget'): 
            gb.configure_column(column, header_name="Annual Budget", aggFunc='sum')
        elif fnmatch.fnmatch(column, '*_ytd_budget'):
            gb.configure_column(column, header_name="YTD Budget", aggFunc='sum')
        elif fnmatch.fnmatch(column, '*_ytd_actual'):
            gb.configure_column(column, header_name="YTD Actual (USD)", aggFunc='sum')
        elif fnmatch.fnmatch(column, '*_daily_budget'):
            gb.configure_column(column, header_name="Budget (USD/Day)", aggFunc='avg')
        elif fnmatch.fnmatch(column, '*_days_ytd'):
            gb.configure_column(column, header_name="Days YTD", aggFunc='sum')
        elif fnmatch.fnmatch(column, '*_daily_actual'):
            gb.configure_column(column, header_name="Actual (USD/Day)")
        elif fnmatch.fnmatch(column, '*_daily_variance'):
            gb.configure_column(column, header_name="Variance (USD/Day)")

I found out what was my error, i had a valueformatter earlier that converted the numbers to a string… This has been fixed and now the avg works :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.