Error Unrecognized Data Set when using st.line_chart

Hi All,
I try to build monitoring system using Streamlit as HMI. I got data from EPICS server, buffered it as array and displayed it as st.line_chart. I did little bit extreme on updating page every 2 second. it run OK until several minutes. it show error below

Screenshot from 2022-09-26 16-46-49

it run in Raspberry Pi 4 Model B- 4 GB RAM on Raspi OS 64 bit. Version of Streamlit is 1.12.2.
I already try to empty placeholder and delete buffer array after program sleep but the error keep coming back.
What can I do to avoid this error? Thank You.

Hi @Septyawan , I would love to help but do you happen to have some code available for me to reproduce? Just by this screenshot, not sure if I can do much.

Thanks,

William

Hi @willhuang , thanks for the response. I’m sorry for not attaching the code.
here is my code which produced the error on screenshot.

import streamlit as st
import pandas as pd
import epics
import datetime
import time

#variable
data_buf = []
time_buf = []

#get data from epics server
def get_epics_data(pvname, type):
    status_text = st.sidebar.status_text
    if (type == 0):
        outval = "{:#.3g}".format(epics.caget(pvname))  
    else:
        outval = epics.caget(pvname)
    return outval

def get_time_now():
    now = datetime.datetime.now()
    hour = '{:02d}'.format(now.hour)
    minute = '{:02d}'.format(now.minute)
    sec = '{:02d}'.format(now.second)
    time_hour = '{}:{}:{}'.format(hour, minute, sec)
    return time_hour

#fifo array
def buffer_data(last_data, data):
    if len(last_data) <= 30:
        last_data.append(data)
    else:
        last_data.pop(0)
        last_data.append(data)
    return last_data

def buffer_time(last_time, time):
    if len(last_time) <= 30:
        last_time.append(time)
    else:
        last_time.pop(0)
        last_time.append(time)
    return last_time


#page config
st.set_page_config(
    page_title = 'KLA60 - Pool Venting System Monitoring',
    layout = 'wide'
)

st.title('KLA60 - Pool Venting System Monitoring')

#streamlit variable
flowval = st.empty()
flowval_dat = st.empty()
flowval_plot = st.empty()

#main program
while True:
    flowval_buff = get_epics_data('VentSys0:AirSpeedM', 1)
    #flowval.write(str(flowval_buff) + ' m3/s')
    flowval.metric('Flow Speed', str(flowval_buff) + ' m³/s')
    data_buf = buffer_data(data_buf, flowval_buff)
    time_buf = buffer_time(time_buf, get_time_now())

    df = pd.DataFrame({
        'date' : time_buf,
        'flow' : data_buf
    })
    
    df = df.rename(columns={'date':'index'}).set_index('index')

    flowval_plot.line_chart(df)
    time.sleep(2)

    flowval_plot.empty()
    del df

when the error come out, there is no error log in the streamlit terminal, only on the webpage.
Thank you.

Hey @Septyawan , I will get to this later today. I have been a little busy! Just wanted to let you know since i haven’t been replying.

Thanks,
William

Hi @Septyawan , I am really sorry about getting to this later!

However, I was looking through the code and it looks like you’re attempting to create some live dashboard for the pool venting system and air flow speed. Is there a minimally reproducible code snippet that I could have in order to reproduce it? It’s hard to reproduce it based off of this code without the epics import.

Thanks,

William