Update pages/1_Earnings_Sentiment_Analysis_π_.py
Browse files
pages/1_Earnings_Sentiment_Analysis_π_.py
CHANGED
@@ -49,14 +49,13 @@ if st.session_state.url or st.session_state.upload:
|
|
49 |
l=5,
|
50 |
r=5,
|
51 |
b=5,
|
52 |
-
t=
|
53 |
pad=2
|
54 |
)
|
55 |
)
|
56 |
|
57 |
-
col1, col2 = st.columns(2)
|
58 |
|
59 |
-
|
60 |
|
61 |
## Display sentiment score
|
62 |
pos_perc = grouped[grouped['sentiment']=='Positive']['count'].iloc[0]*100/sen_df.shape[0]
|
@@ -65,14 +64,14 @@ if st.session_state.url or st.session_state.upload:
|
|
65 |
|
66 |
sentiment_score = neu_perc+pos_perc-neg_perc
|
67 |
|
68 |
-
|
69 |
|
70 |
-
|
71 |
mode = "delta",
|
72 |
value = sentiment_score,
|
73 |
domain = {'row': 1, 'column': 1}))
|
74 |
|
75 |
-
|
76 |
template = {'data' : {'indicator': [{
|
77 |
'title': {'text': "Sentiment score"},
|
78 |
'mode' : "number+delta+gauge",
|
@@ -89,7 +88,9 @@ if st.session_state.url or st.session_state.upload:
|
|
89 |
)
|
90 |
)
|
91 |
|
92 |
-
|
|
|
|
|
93 |
|
94 |
## Display negative sentence locations
|
95 |
fig = px.scatter(sen_df, y='label', color='label', size='score', hover_data=['text'], color_discrete_map={"Negative":"firebrick","Neutral":"navajowhite","Positive":"darkgreen"}, title='Sentiment Score Distribution')
|
|
|
49 |
l=5,
|
50 |
r=5,
|
51 |
b=5,
|
52 |
+
t=10,
|
53 |
pad=2
|
54 |
)
|
55 |
)
|
56 |
|
|
|
57 |
|
58 |
+
st.plotly_chart(fig)
|
59 |
|
60 |
## Display sentiment score
|
61 |
pos_perc = grouped[grouped['sentiment']=='Positive']['count'].iloc[0]*100/sen_df.shape[0]
|
|
|
64 |
|
65 |
sentiment_score = neu_perc+pos_perc-neg_perc
|
66 |
|
67 |
+
fig_1 = go.Figure()
|
68 |
|
69 |
+
fig_1.add_trace(go.Indicator(
|
70 |
mode = "delta",
|
71 |
value = sentiment_score,
|
72 |
domain = {'row': 1, 'column': 1}))
|
73 |
|
74 |
+
fig_1.update_layout(
|
75 |
template = {'data' : {'indicator': [{
|
76 |
'title': {'text': "Sentiment score"},
|
77 |
'mode' : "number+delta+gauge",
|
|
|
88 |
)
|
89 |
)
|
90 |
|
91 |
+
with st.sidebar:
|
92 |
+
|
93 |
+
st.plotly_chart(fig_1)
|
94 |
|
95 |
## Display negative sentence locations
|
96 |
fig = px.scatter(sen_df, y='label', color='label', size='score', hover_data=['text'], color_discrete_map={"Negative":"firebrick","Neutral":"navajowhite","Positive":"darkgreen"}, title='Sentiment Score Distribution')
|