sort topics descending
Browse files
app.py
CHANGED
@@ -318,7 +318,12 @@ def dataframeProcessing(dataset):
|
|
318 |
|
319 |
df['topic'] = [sorted(lda_model_final[corpus][text][0]) for text in range(len(df['original_tweets']))]
|
320 |
|
|
|
|
|
|
|
|
|
321 |
df['topic_string'] = df['topic'].astype(str)
|
|
|
322 |
|
323 |
df = df[df['topic'].map(lambda d: len(d)) > 0]
|
324 |
df['topic'][0]
|
|
|
318 |
|
319 |
df['topic'] = [sorted(lda_model_final[corpus][text][0]) for text in range(len(df['original_tweets']))]
|
320 |
|
321 |
+
def sort_topics(l):
|
322 |
+
return(sorted(l, key=lambda x: x[1], reverse=True))
|
323 |
+
|
324 |
+
df['topic'] = df['topic'].apply(sort_topics)
|
325 |
df['topic_string'] = df['topic'].astype(str)
|
326 |
+
|
327 |
|
328 |
df = df[df['topic'].map(lambda d: len(d)) > 0]
|
329 |
df['topic'][0]
|