Merge pull request 'Implement base missing values strategies' (#3) from feature/missing-values into main
Reviewed-on: https://codefirst.iut.uca.fr/git/clement.freville2/miner/pulls/3 Reviewed-by: Bastien OLLIER <bastien.ollier@noreply.codefirst.iut.uca.fr>
This commit is contained in:
32
frontend/pages/normalization.py
Normal file
32
frontend/pages/normalization.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import streamlit as st
|
||||
from normstrategy import MVStrategy, ScalingStrategy
|
||||
|
||||
if "data" in st.session_state:
|
||||
data = st.session_state.original_data
|
||||
st.session_state.original_data = data.copy()
|
||||
|
||||
for column, series in data.items():
|
||||
col1, col2 = st.columns(2)
|
||||
missing_count = series.isna().sum()
|
||||
choices = MVStrategy.list_available(data, series)
|
||||
option = col1.selectbox(
|
||||
f"Missing values of {column} ({missing_count})",
|
||||
choices,
|
||||
index=1,
|
||||
key=f"mv-{column}",
|
||||
)
|
||||
# Always re-get the series to avoid reusing an invalidated series pointer
|
||||
data = option.apply(data, column, data[column])
|
||||
|
||||
choices = ScalingStrategy.list_available(data, series)
|
||||
option = col2.selectbox(
|
||||
"Scaling",
|
||||
choices,
|
||||
key=f"scaling-{column}",
|
||||
)
|
||||
data = option.apply(data, column, data[column])
|
||||
|
||||
st.write(data)
|
||||
st.session_state.data = data
|
||||
else:
|
||||
st.error("file not loaded")
|
Reference in New Issue
Block a user