thak123 commited on
Commit
fc348ed
1 Parent(s): 1d5f06c

Update index.py

Browse files
Files changed (1) hide show
  1. index.py +4 -3
index.py CHANGED
@@ -167,7 +167,7 @@ def update_output(selected_topic, selected_domain, start_date, end_date):
167
  #set label format on y-axis in line graphs
168
  line_fig_1.update_xaxes(tickformat="%b %d<br>%Y")
169
 
170
- # Bar Graph
171
  grouped_df = df_filtered.groupby(['date', 'Veículos de notícias']).size().reset_index(name='occurrences')
172
 
173
  # Sort DataFrame by 'period' column
@@ -188,7 +188,8 @@ def update_output(selected_topic, selected_domain, start_date, end_date):
188
  bar_fig_1 = px.bar(grouped_df, x='date', y='occurrences', color='Veículos de notícias',
189
  labels={'date': 'Período', 'occurrences': 'Número de notícias', 'Veículos de notícias': 'Portal'},
190
  title='Número de notícias por período de tempo
191
-
 
192
  # filter dataframes based on updated data range
193
  mask_2 = ((df_pos["Topic"] == selected_topic) & (df_pos["domain_folder_name"] == selected_domain) & (df_pos['date'] >= start_date) & (df_pos['date'] <= end_date))
194
  mask_3 = ((df_neu["Topic"] == selected_topic) & (df_neu["domain_folder_name"] == selected_domain) & (df_neu['date'] >= start_date) & (df_neu['date'] <= end_date))
@@ -226,7 +227,7 @@ def update_output(selected_topic, selected_domain, start_date, end_date):
226
  line_fig_3.update_traces(line_color='#004D40')
227
  line_fig_4.update_traces(line_color='#D81B60')
228
 
229
- return line_fig_1, line_fig_2, line_fig_3, line_fig_4
230
 
231
  # return line_fig_1
232
 
 
167
  #set label format on y-axis in line graphs
168
  line_fig_1.update_xaxes(tickformat="%b %d<br>%Y")
169
 
170
+ # Bar Graph start
171
  grouped_df = df_filtered.groupby(['date', 'Veículos de notícias']).size().reset_index(name='occurrences')
172
 
173
  # Sort DataFrame by 'period' column
 
188
  bar_fig_1 = px.bar(grouped_df, x='date', y='occurrences', color='Veículos de notícias',
189
  labels={'date': 'Período', 'occurrences': 'Número de notícias', 'Veículos de notícias': 'Portal'},
190
  title='Número de notícias por período de tempo
191
+ # Bar Graph ends
192
+
193
  # filter dataframes based on updated data range
194
  mask_2 = ((df_pos["Topic"] == selected_topic) & (df_pos["domain_folder_name"] == selected_domain) & (df_pos['date'] >= start_date) & (df_pos['date'] <= end_date))
195
  mask_3 = ((df_neu["Topic"] == selected_topic) & (df_neu["domain_folder_name"] == selected_domain) & (df_neu['date'] >= start_date) & (df_neu['date'] <= end_date))
 
227
  line_fig_3.update_traces(line_color='#004D40')
228
  line_fig_4.update_traces(line_color='#D81B60')
229
 
230
+ return line_fig_1, line_fig_2, line_fig_3, line_fig_4, bar_fig_1
231
 
232
  # return line_fig_1
233