Spaces:
Sleeping
Sleeping
Commit ·
f0ef461
1
Parent(s): 9cde3c1
Update eda.py
Browse files
eda.py
CHANGED
|
@@ -1,9 +1,45 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
from PIL import Image
|
|
|
|
| 4 |
|
| 5 |
def run():
|
| 6 |
'''
|
| 7 |
Function for EDA page
|
| 8 |
'''
|
| 9 |
-
st.title('Exploration Data Analysis Section')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
from PIL import Image
|
| 4 |
+
import plotly.express as px
|
| 5 |
|
| 6 |
def run():
|
| 7 |
'''
|
| 8 |
Function for EDA page
|
| 9 |
'''
|
| 10 |
+
st.title('Exploration Data Analysis Section')
|
| 11 |
+
|
| 12 |
+
# ============================= Simple Analysis ========================
|
| 13 |
+
|
| 14 |
+
eda=pd.read_csv('eda.csv')
|
| 15 |
+
# emotion distribution
|
| 16 |
+
fig_emotions = px.bar(emotion_counts,
|
| 17 |
+
x=emotion_counts.index,
|
| 18 |
+
y=emotion_counts.values,
|
| 19 |
+
labels={'x': 'Emotion', 'y': 'Count'},
|
| 20 |
+
title='Distribution of Emotions')
|
| 21 |
+
fig_emotions.update_traces(marker_line_width=1, marker_line_color='black')
|
| 22 |
+
fig_emotions.update_layout(xaxis_title='Emotions', yaxis_title='Count', width=1000)
|
| 23 |
+
|
| 24 |
+
# comment distribution
|
| 25 |
+
fig_comment_length = px.histogram(eda,
|
| 26 |
+
x='Comment Length',
|
| 27 |
+
nbins=30,
|
| 28 |
+
marginal='box',
|
| 29 |
+
title='Distribution of Comment Length')
|
| 30 |
+
fig_comment_length.update_traces(marker_line_width=1, marker_line_color='black')
|
| 31 |
+
fig_comment_length.update_layout(xaxis_title='Length of Comment', yaxis_title='Count', width=1000, bargap=0)
|
| 32 |
+
|
| 33 |
+
# word count distribution
|
| 34 |
+
fig_word_count = px.histogram(eda,
|
| 35 |
+
x='Word Count',
|
| 36 |
+
nbins=30,
|
| 37 |
+
marginal='box',
|
| 38 |
+
title='Distribution of Word Count')
|
| 39 |
+
fig_word_count.update_traces(marker_line_width=1, marker_line_color='black')
|
| 40 |
+
fig_word_count.update_layout(xaxis_title='Word Count', yaxis_title='Count', width=1000)
|
| 41 |
+
|
| 42 |
+
# Display the figures in Streamlit
|
| 43 |
+
st.plotly_chart(fig_emotions)
|
| 44 |
+
st.plotly_chart(fig_comment_length)
|
| 45 |
+
st.plotly_chart(fig_word_count)
|