Update pages/1_Earnings_Sentiment_Analysis_π_.py
Browse files
pages/1_Earnings_Sentiment_Analysis_π_.py
CHANGED
|
@@ -4,6 +4,7 @@ import plotly_express as px
|
|
| 4 |
import plotly.graph_objects as go
|
| 5 |
from functions import *
|
| 6 |
import validators
|
|
|
|
| 7 |
|
| 8 |
#st.set_page_config(page_title="Earnings Sentiment Analysis", page_icon="π")
|
| 9 |
st.sidebar.header("Sentiment Analysis")
|
|
@@ -97,15 +98,16 @@ try:
|
|
| 97 |
with st.sidebar:
|
| 98 |
|
| 99 |
st.plotly_chart(fig_1)
|
| 100 |
-
|
|
|
|
| 101 |
## Display negative sentence locations
|
| 102 |
-
fig = px.scatter(sen_df, y='label', color='label', size='score', hover_data=[
|
| 103 |
|
| 104 |
|
| 105 |
fig.update_layout(
|
| 106 |
showlegend=False,
|
| 107 |
autosize=True,
|
| 108 |
-
width=
|
| 109 |
height=500,
|
| 110 |
margin=dict(
|
| 111 |
b=5,
|
|
|
|
| 4 |
import plotly.graph_objects as go
|
| 5 |
from functions import *
|
| 6 |
import validators
|
| 7 |
+
import textwrap
|
| 8 |
|
| 9 |
#st.set_page_config(page_title="Earnings Sentiment Analysis", page_icon="π")
|
| 10 |
st.sidebar.header("Sentiment Analysis")
|
|
|
|
| 98 |
with st.sidebar:
|
| 99 |
|
| 100 |
st.plotly_chart(fig_1)
|
| 101 |
+
|
| 102 |
+
hd = sen_df.text.apply(lambda txt: '<br>'.join(textwrap.wrap(txt, width=70)))
|
| 103 |
## Display negative sentence locations
|
| 104 |
+
fig = px.scatter(sen_df, y='label', color='label', size='score', hover_data=[hd], color_discrete_map={"Negative":"firebrick","Neutral":"navajowhite","Positive":"darkgreen"}, title='Sentiment Score Distribution')
|
| 105 |
|
| 106 |
|
| 107 |
fig.update_layout(
|
| 108 |
showlegend=False,
|
| 109 |
autosize=True,
|
| 110 |
+
width=800,
|
| 111 |
height=500,
|
| 112 |
margin=dict(
|
| 113 |
b=5,
|