fin separation front/back

This commit is contained in:
hugo.pradier2
2024-06-23 17:44:26 +02:00
parent 15e1674cb2
commit 7dafa78bc4
13 changed files with 201 additions and 131 deletions

View File

@@ -1,30 +1,25 @@
import streamlit as st
import matplotlib.pyplot as plt
import seaborn as sns
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../backend')))
from visualization_strategy import plot_histogram, plot_boxplot
st.header("Data Visualization")
if "data" in st.session_state:
data = st.session_state.data
st.subheader("Histogram")
column_to_plot = st.selectbox("Select Column for Histogram", data.columns)
if column_to_plot:
fig, ax = plt.subplots()
ax.hist(data[column_to_plot].dropna(), bins=20, edgecolor='k')
ax.set_title(f"Histogram of {column_to_plot}")
ax.set_xlabel(column_to_plot)
ax.set_ylabel("Frequency")
fig = plot_histogram(data, column_to_plot)
st.pyplot(fig)
st.subheader("Boxplot")
dataNumeric = data.select_dtypes(include="number")
column_to_plot = st.selectbox("Select Column for Boxplot", dataNumeric.columns)
if column_to_plot:
fig, ax = plt.subplots()
sns.boxplot(data=data, x=column_to_plot, ax=ax)
ax.set_title(f"Boxplot of {column_to_plot}")
fig = plot_boxplot(data, column_to_plot)
st.pyplot(fig)
else:
st.error("file not loaded")
st.error("file not loaded")