import streamlit as st import pandas as pd from PIL import Image import plotly.express as px def run(): ''' Function for EDA page ''' st.title('Exploration Data Analysis Section') # ============================= Simple Analysis ======================== eda=pd.read_csv('eda.csv') # basic summary analysis emotion_counts = eda['Emotion'].value_counts() eda['Comment Length'] = eda['Comment'].apply(len) eda['Word Count'] = eda['Comment'].apply(lambda x: len(x.split())) # emotion distribution fig_emotions = px.bar(emotion_counts, x=emotion_counts.index, y=emotion_counts.values, labels={'x': 'Emotion', 'y': 'Count'}, title='Distribution of Emotions') fig_emotions.update_traces(marker_line_width=1, marker_line_color='black') fig_emotions.update_layout(xaxis_title='Emotions', yaxis_title='Count', width=1000) # comment distribution fig_comment_length = px.histogram(eda, x='Comment Length', nbins=30, marginal='box', title='Distribution of Comment Length') fig_comment_length.update_traces(marker_line_width=1, marker_line_color='black') fig_comment_length.update_layout(xaxis_title='Length of Comment', yaxis_title='Count', width=1000, bargap=0) # word count distribution fig_word_count = px.histogram(eda, x='Word Count', nbins=30, marginal='box', title='Distribution of Word Count') fig_word_count.update_traces(marker_line_width=1, marker_line_color='black') fig_word_count.update_layout(xaxis_title='Word Count', yaxis_title='Count', width=1000) # Display the figures in Streamlit st.plotly_chart(fig_emotions) st.plotly_chart(fig_comment_length) st.plotly_chart(fig_word_count)