Spaces:
Runtime error
Runtime error
stable now
Browse files
app.py
CHANGED
@@ -106,7 +106,7 @@ def main(from_date,
|
|
106 |
elif col == 'sentiment':
|
107 |
pie_charts.append(pie_chart(db[0], col, col + ": " + db[1]))
|
108 |
elif col == TOPIC:
|
109 |
-
pie_charts.append(nested_pie_chart(db[0]
|
110 |
return pie_charts
|
111 |
|
112 |
def bar(db: pd.DataFrame, title):
|
@@ -175,7 +175,12 @@ def main(from_date,
|
|
175 |
plt.title(title, fontdict=font1)
|
176 |
return fig
|
177 |
|
178 |
-
def nested_pie_chart(df
|
|
|
|
|
|
|
|
|
|
|
179 |
if df.empty:
|
180 |
return None
|
181 |
else:
|
@@ -214,7 +219,7 @@ def main(from_date,
|
|
214 |
wedgeprops=dict(width=size, edgecolor='w'))
|
215 |
ax.pie(vals.flatten(), radius=1 - size, colors=inner_colors,
|
216 |
wedgeprops=dict(width=size, edgecolor='w'))
|
217 |
-
ax.set(aspect='equal', title='
|
218 |
return fig
|
219 |
|
220 |
# text_classifier = tc.TextClassifier(from_date=from_date, to_date=to_date,
|
|
|
106 |
elif col == 'sentiment':
|
107 |
pie_charts.append(pie_chart(db[0], col, col + ": " + db[1]))
|
108 |
elif col == TOPIC:
|
109 |
+
pie_charts.append(nested_pie_chart(db[0]))
|
110 |
return pie_charts
|
111 |
|
112 |
def bar(db: pd.DataFrame, title):
|
|
|
175 |
plt.title(title, fontdict=font1)
|
176 |
return fig
|
177 |
|
178 |
+
def nested_pie_chart(df):
|
179 |
+
"""
|
180 |
+
This method adds a nested pie chart. The pie chart shows the sentiment for each target.
|
181 |
+
:param df: dataframe with data. The selected leaders have non-empty entries in the dataframe.
|
182 |
+
:return: figure with the nested pie chart.
|
183 |
+
"""
|
184 |
if df.empty:
|
185 |
return None
|
186 |
else:
|
|
|
219 |
wedgeprops=dict(width=size, edgecolor='w'))
|
220 |
ax.pie(vals.flatten(), radius=1 - size, colors=inner_colors,
|
221 |
wedgeprops=dict(width=size, edgecolor='w'))
|
222 |
+
ax.set(aspect='equal', title='Topic (outer circle) and its corresponding sentiment (inner circle)')
|
223 |
return fig
|
224 |
|
225 |
# text_classifier = tc.TextClassifier(from_date=from_date, to_date=to_date,
|