Spaces:
Sleeping
Sleeping
Update index.py
Browse files
index.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from dash import Dash, html, dcc, callback, Output, Input
|
2 |
import plotly.express as px
|
3 |
from app import app
|
@@ -8,9 +9,8 @@ import requests
|
|
8 |
from io import StringIO
|
9 |
from datetime import date
|
10 |
|
11 |
-
import
|
12 |
-
from
|
13 |
-
from dash.dependencies import Input, Output
|
14 |
import dash_bootstrap_components as dbc
|
15 |
import plotly.express as px
|
16 |
|
@@ -91,16 +91,16 @@ def update_output(selected_topic, start_date, end_date):
|
|
91 |
df_filtered = df.loc[mask_1]
|
92 |
|
93 |
|
94 |
-
#create line graphs based on filtered dataframes
|
95 |
line_fig_1 = px.line(df_filtered, x="date", y="normalised results",
|
96 |
color='Veículos de notícias', title="O gráfico mostra a evolução temporal de sentimento dos títulos de notícias. Numa escala de -1 (negativo) a 1 (positivo), sendo 0 (neutro).")
|
97 |
|
98 |
-
#set x-axis title and y-axis title in line graphs
|
99 |
line_fig_1.update_layout(
|
100 |
xaxis_title='Data',
|
101 |
yaxis_title='Classificação de Sentimento')
|
102 |
|
103 |
-
#set label format on y-axis in line graphs
|
104 |
line_fig_1.update_xaxes(tickformat="%b %d<br>%Y")
|
105 |
|
106 |
return line_fig_1
|
|
|
1 |
+
import dash
|
2 |
from dash import Dash, html, dcc, callback, Output, Input
|
3 |
import plotly.express as px
|
4 |
from app import app
|
|
|
9 |
from io import StringIO
|
10 |
from datetime import date
|
11 |
|
12 |
+
# from jupyter_dash import JupyterDash
|
13 |
+
# from dash.dependencies import Input, Output
|
|
|
14 |
import dash_bootstrap_components as dbc
|
15 |
import plotly.express as px
|
16 |
|
|
|
91 |
df_filtered = df.loc[mask_1]
|
92 |
|
93 |
|
94 |
+
#create line graphs based on filtered dataframes
|
95 |
line_fig_1 = px.line(df_filtered, x="date", y="normalised results",
|
96 |
color='Veículos de notícias', title="O gráfico mostra a evolução temporal de sentimento dos títulos de notícias. Numa escala de -1 (negativo) a 1 (positivo), sendo 0 (neutro).")
|
97 |
|
98 |
+
#set x-axis title and y-axis title in line graphs
|
99 |
line_fig_1.update_layout(
|
100 |
xaxis_title='Data',
|
101 |
yaxis_title='Classificação de Sentimento')
|
102 |
|
103 |
+
#set label format on y-axis in line graphs
|
104 |
line_fig_1.update_xaxes(tickformat="%b %d<br>%Y")
|
105 |
|
106 |
return line_fig_1
|