I have created a sidebar with radio buttons and each radio button will load their individual pages but the variable information will be passed from one page to another page.
The sequence is like this:
Data Load -> transform -> EDA
So a person has to click load the dataset and pass the loaded dataset into next page i.e., EDA or Transform.
I have created a sample code for it:
import src.pages.data_injection as data_load import src.pages.EDA as EDA import streamlit as st import pandas as pd import numpy as np def main(): st.sidebar.title("Navigate") selection = st.sidebar.radio("Choose a module", PAGES) if selection == "Data Injection": df = data_load.load_page() # this loads page of Data Injection data = df # create copy of df .... I am getting error here "local variable 'df' referenced before assignment" if selection == "EDA": EDA.load_page(data) # this should load EDA page by passing "data" as a variable if __name__ == '__main__': main()
Please let me know how to solve this issue?