MarshallComponentException: ("Could not convert component args to JSON. If you're using custom JsCode objects on gridOptions, ensure that allow_unsafe_jscode is True.", TypeError('Object of type function is not JSON serializable'))
Traceback:
File "/Users/liang/Documents/GPT/youtube-gpt/web/test.py", line 27, in
st_aggrid.AgGrid(
File "/Users/liang/Library/Python/3.9/lib/python/site-packages/st_aggrid/init.py", line 370, in AgGrid
raise(ex)
import streamlit as st import pandas as pd import st_aggrid
Load data from output.csv file
data = pd.read_csv("output.csv")
Define onRowClicked callback function
def selected_row(params): selected_row_data = params['data'] st.write(selected_row_data)
Set grid options
grid_options = { 'rowSelection': 'single', 'onRowClicked': selected_row }
Display st_aggrid table with data and grid options
st_aggrid.AgGrid(data, gridOptions=grid_options, height=500, width='100%')
ERROR:
MarshallComponentException: ("Could not convert component args to JSON. If you're using custom JsCode objects on gridOptions, ensure that allow_unsafe_jscode is True.", TypeError('Object of type function is not JSON serializable'))
Traceback: File "/Users/liang/Documents/GPT/youtube-gpt/web/test.py", line 27, in
st_aggrid.AgGrid(
File "/Users/liang/Library/Python/3.9/lib/python/site-packages/st_aggrid/init.py", line 370, in AgGrid
raise(ex)