Having problem displaying unstacked dataframe in streamlit

Ask the community or our support engineers for answers to questions.

combined_summary_df is a multiindex dataframe

> data_to_graph = combined_summary_df.unstack(level=1, fill_value=0)
> 
> with st.expander("Where to test everything related to graph"):
>     st.write(data_to_graph)

I am new to Streamlit. I would like to impress my superior with it. Any help, Please!!!

This error has been returned everytime I used the chunk of code above to display my dataframe in Streamlit:

SyntaxError: Unexpected token s in JSON at position 6

at JSON.parse (<anonymous>)
at http://localhost:8501/static/js/main.970d3503.chunk.js:2:17823
at Array.map (<anonymous>)
at Function.value (http://localhost:8501/static/js/main.970d3503.chunk.js:2:17792)
at new e (http://localhost:8501/static/js/main.970d3503.chunk.js:2:10780)
at e.get (http://localhost:8501/static/js/main.970d3503.chunk.js:2:428662)
at sn (http://localhost:8501/static/js/main.970d3503.chunk.js:2:461308)
at ia (http://localhost:8501/static/js/5.26b8f29c.chunk.js:2:3245026)
at Gl (http://localhost:8501/static/js/5.26b8f29c.chunk.js:2:3297484)
at Pc (http://localhost:8501/static/js/5.26b8f29c.chunk.js:2:3284658)

I found this:

This is what I found :

Getting this error in your code?

Unhandled Rejection (SyntaxError): Unexpected token in JSON at position 0

The position and the character may vary, but it’s all caused by the same thing. Here’s how to fix it.

This happens when you make a request to the server and parse the response as JSON, but it’s not JSON.

But the author ask to refer to the creator (Developers of the streamlit app).