Hi
I am trying to re-generate/ output a dataframe & Plotly chart after there is new data generated.
The issue is that my code writes the dataframe & Plotly chart one after another.
Is it possible to write over /replace the existing dataframe & Plotly chart once new data is generated? (i.e only 1 data frame is written)
import streamlit as st
import time
import pandas as pd
@st.cache
def output_new_df(a, b):
return pd.DataFrame([a,b])
def generate_new_data(a):
time.sleep(2)
a = 10+ a
return a
def main():
loop = st.checkbox('Update Continuously')
a = 0
b = 21
df = output_new_df(a, b)
df
while loop:
a = generate_new_data(a)
df = output_new_df(a, b)
df
main()