Spaces:
Runtime error
Runtime error
chore: refactor
Browse files
app.py
CHANGED
@@ -77,18 +77,18 @@ with col2:
|
|
77 |
if 'df' in list(st.session_state.keys()):
|
78 |
df_right = st.session_state.df.copy(deep=True)
|
79 |
if "baseline" in list(df_right.keys()):
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
if not df_base.empty:
|
94 |
st.warning("Consider running outlier detection to clean your data!", icon="⚠️")
|
|
|
77 |
if 'df' in list(st.session_state.keys()):
|
78 |
df_right = st.session_state.df.copy(deep=True)
|
79 |
if "baseline" in list(df_right.keys()):
|
80 |
+
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?")
|
81 |
+
option = st.multiselect('Select a feature to merge', [k for k in list(df_right.keys()) if k != 'baseline'], [[k for k in list(df_right.keys()) if k != 'baseline'][-3]])
|
82 |
+
relative_key = f"relative_{option[0]}"
|
83 |
+
add_relative = st.button(f"Add {relative_key}")
|
84 |
+
if add_relative:
|
85 |
+
baseline_mean = [sum(s)/len(s) for s in df['baseline']]
|
86 |
+
df_right['relative_pupil_dilation'] = [df[option[0]][i] - baseline_mean[i] for i in range(len(df))]
|
87 |
+
st.markdown("After adding calculated fields")
|
88 |
+
st.dataframe(df_right)
|
89 |
+
with open('myfile.csv') as f:
|
90 |
+
st.download_button('Download CSV', f)
|
91 |
+
st.info("Your data has been downloaded, you can visualize and detect outliers in the 'Plotting' and 'Detect Outliers' pages on the sidebar.")
|
92 |
|
93 |
if not df_base.empty:
|
94 |
st.warning("Consider running outlier detection to clean your data!", icon="⚠️")
|