exploration initiale + debut visualisation

visualisation
Hugo PRADIER 6 months ago
parent 5a664243fd
commit d726f86c06

@ -1,10 +1,60 @@
import pandas as pd import pandas as pd
import streamlit as st import streamlit as st
import matplotlib.pyplot as plt
import seaborn as sns
st.title("Hello world!") st.title("Project Miner")
uploaded_file = st.file_uploader("Choose a file") # File uploader
if uploaded_file is not None: uploaded_file = st.file_uploader("Upload your CSV file", type=["csv"])
df = pd.read_csv(uploaded_file)
st.write(df.head(10)) if uploaded_file:
st.write(df.tail(10)) data = pd.read_csv(uploaded_file)
st.success("File loaded successfully!")
# Data Preview
st.header("Data Preview")
st.subheader("First 5 Rows")
st.write(data.head())
st.subheader("Last 5 Rows")
st.write(data.tail())
# Data Summary
st.header("Data Summary")
st.subheader("Basic Information")
st.write(f"Number of Rows: {data.shape[0]}")
st.write(f"Number of Columns: {data.shape[1]}")
st.write(f"Column Names: {list(data.columns)}")
st.subheader("Missing Values by Column")
missing_values = data.isnull().sum()
st.write(missing_values)
st.subheader("Statistical Summary")
st.write(data.describe())
# Data Visualization
st.header("Data Visualization")
# Histogram
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')
st.pyplot(fig)
# Boxplot
st.subheader("Boxplot")
column_to_plot_box = st.selectbox("Select Column for Boxplot", data.columns, key="boxplot")
if column_to_plot_box:
fig, ax = plt.subplots()
sns.boxplot(y=data[column_to_plot_box].dropna(), ax=ax)
ax.set_title(f'Boxplot of {column_to_plot_box}')
st.pyplot(fig)

Loading…
Cancel
Save