Files
miner/frontend/pages/visualization.py
2024-06-23 17:44:26 +02:00

26 lines
808 B
Python

import streamlit as st
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 = 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 = plot_boxplot(data, column_to_plot)
st.pyplot(fig)
else:
st.error("file not loaded")