Mutate Tabular Data with Streamlit

Streamlit has the option to add data to an existing dataframe or chart. This is useful in scenarios where you may already have data on hand, but further work results in more data being collected. Instead of having to set up a new dataframe from scratch, Streamlit allows you to use the add_rows() method to update the existing dataframe.

df1 = pd.DataFrame({“A”: [94, 25, 70, 90, 26], “B”: [17, 46, 59, 195, 126], “C”: [96, 267, 214, 209, 31]})

df2 = pd.DataFrame({“A”: [69, 42, 51], “B”: [192, 136, 33], “C”: [145, 263, 125]})

st.dataframe(df1) st.dataframe(df2) df = st.dataframe(df1) df.add_rows(df2)

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy