Milestone2 / eda.py
Kurkur99's picture
Upload 10 files
d574e4c
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def run_eda_app(data):
st.subheader('Exploratory Data Analysis')
# Display data
st.write("Here's a glimpse of the dataset:")
st.write(data.head())
# Show data distribution
if st.checkbox('Show data distribution'):
st.write('Data distribution:')
fig, ax = plt.subplots()
data.hist(ax=ax, bins=30, figsize=(20,15))
st.pyplot(fig)
# Correlation heatmap
if st.checkbox('Show correlation heatmap'):
st.write('Correlation heatmap:')
fig, ax = plt.subplots(figsize=(10,8))
sns.heatmap(data.corr(), annot=True, cmap='coolwarm', ax=ax)
st.pyplot(fig)
# Monthly distribution of sessions
if st.checkbox('Show monthly distribution of sessions'):
st.write('Monthly distribution of sessions:')
fig, ax = plt.subplots(figsize=(10,6))
data['Month'].value_counts().plot(kind='bar', ax=ax)
ax.set_title('Number of sessions per month')
ax.set_ylabel('Count')
st.pyplot(fig)