Spaces:
Runtime error
Runtime error
chore: better flow
Browse files
app.py
CHANGED
@@ -84,11 +84,12 @@ with col1:
|
|
84 |
df_right.baseline = df_right.baseline.map(lambda ser: [f for f in ser if f != 0.0])
|
85 |
st.session_state['df'] = df_right.copy(deep=True)
|
86 |
st.success("Blinking values have been removed!")
|
|
|
87 |
elif detect_blinking and not number_of_blinks:
|
88 |
st.caption("No blinking values were found in your data! ")
|
89 |
|
90 |
# Add calculated fields
|
91 |
-
if 'df' in
|
92 |
df_right = st.session_state.df.copy(deep=True)
|
93 |
if "baseline" in list(df_right.keys()):
|
94 |
st.markdown(f"A **baseline** feature has been found on your data, do you want to merge it with any of the other features in a new calculated field?")
|
@@ -98,10 +99,11 @@ if 'df' in list(st.session_state.keys()):
|
|
98 |
if add_relative:
|
99 |
baseline_mean = [sum(s)/len(s) for s in df_right['baseline']]
|
100 |
df_right[relative_key] = [[field_value - baseline_mean[i] for field_value in df_right[option[0]][i]] for i in range(len(df_right))]
|
101 |
-
st.markdown("After adding calculated fields")
|
102 |
st.dataframe(df_right)
|
103 |
csv = convert_df(df_right)
|
104 |
-
|
|
|
105 |
# Save transformations to disk
|
106 |
downl = st.download_button("Download CSV 💾", csv, "file.csv", "text/csv", key='download-csv')
|
107 |
if downl:
|
|
|
84 |
df_right.baseline = df_right.baseline.map(lambda ser: [f for f in ser if f != 0.0])
|
85 |
st.session_state['df'] = df_right.copy(deep=True)
|
86 |
st.success("Blinking values have been removed!")
|
87 |
+
st.session_state.df_base = df_right
|
88 |
elif detect_blinking and not number_of_blinks:
|
89 |
st.caption("No blinking values were found in your data! ")
|
90 |
|
91 |
# Add calculated fields
|
92 |
+
if 'df' in st.session_state or 'df_right' in st.session_state:
|
93 |
df_right = st.session_state.df.copy(deep=True)
|
94 |
if "baseline" in list(df_right.keys()):
|
95 |
st.markdown(f"A **baseline** feature has been found on your data, do you want to merge it with any of the other features in a new calculated field?")
|
|
|
99 |
if add_relative:
|
100 |
baseline_mean = [sum(s)/len(s) for s in df_right['baseline']]
|
101 |
df_right[relative_key] = [[field_value - baseline_mean[i] for field_value in df_right[option[0]][i]] for i in range(len(df_right))]
|
102 |
+
st.markdown("After adding calculated fields and removing blinking values (when applied)")
|
103 |
st.dataframe(df_right)
|
104 |
csv = convert_df(df_right)
|
105 |
+
if 'df_right' not in st.session_state:
|
106 |
+
st.session_state['df_right'] = df_right
|
107 |
# Save transformations to disk
|
108 |
downl = st.download_button("Download CSV 💾", csv, "file.csv", "text/csv", key='download-csv')
|
109 |
if downl:
|