Dash AG Grid - Display NaN and Infinity

Hi there!

I am trying to display a Dash AG Grid table from a Pandas DataFrame. One of the columns (‘Difference’) contains numbers along with np.inf and np.nan.
I would like to output the numerical values as percentage values. If I format them using d3.format, the inf and nan fields come up as 0.00% (they are empty without any formatting).
However, it is important, that the infinity fields are displayed as infinity and behave accordingly when the table is sorted. The nan fields should be empty or “NaN”.
I’ve seen that it is possible to display “Infinity” when using a function for valueGetter, but I do not know how it is possible when using a Pandas DataFrame.
I tried using value formatter and a custom function but my JS and CSS knowledge is very limited, and I cannot get it to work.

This is my example:

from dash import Dash, Input, Output, callback, html, dcc
import dash_ag_grid as dag
import numpy as np
import pandas as pd
import copy

df = pd.DataFrame({'Name'       : ['Test1', 'Test1', 'Test2', 'Test4', 'Test5'],
                   'ID'         : ['A1', 'A2', 'A3', 'A4', 'A5'],
                   'Difference' : [0.1, .35125, np.inf, np.nan, -np.inf]})

app = Dash(__name__)
app.layout = html.Div([
    dcc.Dropdown(id="Name_drop", options=sorted(df['Name'].unique()), multi=True),
    html.Br(),
    dag.AgGrid(
        id="table",
        defaultColDef={"resizable": True, "sortable": True},
        dashGridOptions={"pagination": True, "rowSelection": "single", 'multiSortKey': 'ctrl'},
        ),
])

@callback(
    Output("table", "rowData"),
    Output("table", "columnDefs"),
    Input("Name_drop", "value"),
)
def table_output(name):
    dff = copy.deepcopy(df)

    if name not in [None, []]:
        dff = dff.loc[dff['Name'].isin(name)]

    rowData = dff.to_dict("records")

    columnDefs = [{'field': 'Name'}, {'field': 'ID'}, {'field': 'Difference', "valueFormatter": {"function": "d3.format('.2%')(params.value)"}}]
    return rowData, columnDefs

if __name__ == '__main__':
    app.run()

I am grateful for any leads.