Spaces:
Runtime error
Runtime error
chore: cleanup
Browse files- pages/1_📈_Plotting.py +6 -4
pages/1_📈_Plotting.py
CHANGED
@@ -7,6 +7,7 @@ st.header("Plotting Time Series Data")
|
|
7 |
st.markdown("Users can load their time-series data in **.csv** format and select a particular feature and plot-type.\
|
8 |
Go ahead and use the sidebar on the left to upload your data files to start visualizing it!")
|
9 |
|
|
|
10 |
with st.sidebar:
|
11 |
plot = st.radio("Select the kind of visualization:",('Feature collection', 'Users comparison', 'Data distribution'))
|
12 |
file = st.file_uploader("Load CSV file", accept_multiple_files = False)
|
@@ -31,6 +32,7 @@ df_base = st.session_state.df if 'df' in st.session_state else pd.DataFrame()
|
|
31 |
n = len(df_base)
|
32 |
col1, col2 = st.columns(2)
|
33 |
|
|
|
34 |
if not df_base.empty and not n:
|
35 |
with col1:
|
36 |
st.info(f"Your data has {n} samples.")
|
@@ -46,14 +48,13 @@ if not df_base.empty and not n:
|
|
46 |
df_plot = [ini_list.strip('][').split(',') for ini_list in df_plot[feature]]
|
47 |
df_plot = pd.DataFrame(df_plot)
|
48 |
df_plot.columns = [str(column) for column in range(len(df_plot.columns))]
|
49 |
-
# st.caption(f"Columns of df_plot: {list(df_plot.columns)}")
|
50 |
st.caption(f"Axes of df_plot: {df_plot.axes}")
|
51 |
if 'df_plot' not in st.session_state:
|
52 |
st.session_state['df_plot'] = df_plot
|
53 |
with st.expander("See explanation"):
|
54 |
st.caption("The chart above shows...")
|
55 |
-
|
56 |
-
|
57 |
if 'df_plot' in st.session_state:
|
58 |
with st.spinner(f"Drawing plot to visualize {plot.lower()}"):
|
59 |
st.caption("Your visualization:")
|
@@ -69,4 +70,5 @@ if 'df_plot' in st.session_state:
|
|
69 |
st.line_chart(df_plot_t, y=list(df_plot_t.columns), height=600, width=600)
|
70 |
elif df_base.empty and file:
|
71 |
st.warning("Consider running outlier detection to clean your data!", icon="⚠️")
|
72 |
-
|
|
|
|
7 |
st.markdown("Users can load their time-series data in **.csv** format and select a particular feature and plot-type.\
|
8 |
Go ahead and use the sidebar on the left to upload your data files to start visualizing it!")
|
9 |
|
10 |
+
# Load and config
|
11 |
with st.sidebar:
|
12 |
plot = st.radio("Select the kind of visualization:",('Feature collection', 'Users comparison', 'Data distribution'))
|
13 |
file = st.file_uploader("Load CSV file", accept_multiple_files = False)
|
|
|
32 |
n = len(df_base)
|
33 |
col1, col2 = st.columns(2)
|
34 |
|
35 |
+
# Prepare data
|
36 |
if not df_base.empty and not n:
|
37 |
with col1:
|
38 |
st.info(f"Your data has {n} samples.")
|
|
|
48 |
df_plot = [ini_list.strip('][').split(',') for ini_list in df_plot[feature]]
|
49 |
df_plot = pd.DataFrame(df_plot)
|
50 |
df_plot.columns = [str(column) for column in range(len(df_plot.columns))]
|
|
|
51 |
st.caption(f"Axes of df_plot: {df_plot.axes}")
|
52 |
if 'df_plot' not in st.session_state:
|
53 |
st.session_state['df_plot'] = df_plot
|
54 |
with st.expander("See explanation"):
|
55 |
st.caption("The chart above shows...")
|
56 |
+
|
57 |
+
# Draw plot
|
58 |
if 'df_plot' in st.session_state:
|
59 |
with st.spinner(f"Drawing plot to visualize {plot.lower()}"):
|
60 |
st.caption("Your visualization:")
|
|
|
70 |
st.line_chart(df_plot_t, y=list(df_plot_t.columns), height=600, width=600)
|
71 |
elif df_base.empty and file:
|
72 |
st.warning("Consider running outlier detection to clean your data!", icon="⚠️")
|
73 |
+
|
74 |
+
st.caption(f"developer:: session_state keys: {list(st.session_state.keys())}")
|