You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.4 KiB
37 lines
1.4 KiB
import streamlit as st
|
|
from normstrategy import MVStrategy, ScalingStrategy, KNNStrategy
|
|
|
|
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, column, series)
|
|
option = col1.selectbox(
|
|
f"Missing values of {column} ({missing_count})",
|
|
choices,
|
|
index=1,
|
|
key=f"mv-{column}",
|
|
)
|
|
if isinstance(option, KNNStrategy):
|
|
print(option.available_features)
|
|
option.training_features = st.multiselect("Training columns", option.training_features, default=option.available_features, key=f"cols-{column}")
|
|
option.n_neighbors = st.number_input("Number of neighbors", min_value=1, value=option.n_neighbors, key=f"neighbors-{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")
|