St.altair_chart with dataframe not working

Hello everyone,

I have the below dataframe:

I am only interested in plotting the Communications column with the index (‘Put Quotetime’). I run the following code to plot a line chart with st.altair_chart

Altair_Figure = alt.Chart(DataFrame).mark_line().encode(
    x = DataFrame['Put Quotetime],
    y = DataFrame['Communications])

The output from altair is:

And the ouput from streamlit is:
Screenshot (24)

More details:

My project is relatively simple, I have multiple dataframes like the one in this example, and I would like to just create line charts for it. Using the st.sidebar.checkbox function, I hope to overlay each of the line charts atop each other. This is the ultimate goal of the project and the logic is already written for the part of the checkboxes. I’m just finding plotting the lines to be impossible. Any help is greatly appreciated, thank you.

Hi Mantis! I can see a small quotation typo in your code.

Altair_Figure = alt.Chart(DataFrame).mark_line().encode(
    x = DataFrame['Put Quotetime'],
    y = DataFrame['Communications'])

I think this is the code you meant to try out. It might be good to check your datatype. Try to see what the datatype is for the two columns in your dataframe by using DataFrame.dtype in your notebook. Are both the columns in the correct datatypes?