import pandas as pd import streamlit as st import matplotlib.pyplot as plt import seaborn as sns st.title("Project Miner") # File uploader uploaded_file = st.file_uploader("Upload your CSV file", type=["csv"]) if uploaded_file: 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)