Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -131,13 +131,13 @@ def process_reviews(df, review_column, class_names):
|
|
131 |
df_display = scores_to_percent(df_new.copy())
|
132 |
|
133 |
# Get all columns excluding the created ones and the review_column
|
134 |
-
remaining_columns = [col for col in df.columns if col not in [review_column, 'raw_scores', 'Weighted Rating', 'Rating', 'Probability', '1 Star', '2 Star', '3 Star', '4 Star', '5 Star']]
|
135 |
|
136 |
# Reorder the dataframe with selected columns first, created columns next, then the remaining columns
|
137 |
-
df_new = df_new[[review_column, 'Weighted Rating', 'Rating', 'Probability', '1 Star', '2 Star', '3 Star', '4 Star', '5 Star'
|
138 |
|
139 |
# Reorder df_display as well
|
140 |
-
df_display = df_display[[review_column, 'Weighted Rating', 'Rating', 'Probability', '1 Star', '2 Star', '3 Star', '4 Star', '5 Star'
|
141 |
|
142 |
return df_new, df_display
|
143 |
|
|
|
131 |
df_display = scores_to_percent(df_new.copy())
|
132 |
|
133 |
# Get all columns excluding the created ones and the review_column
|
134 |
+
remaining_columns = [col for col in df.columns if col not in [review_column, 'raw_scores', 'Weighted Rating', 'Rating', 'Probability', '1 Star', '2 Star', '3 Star', '4 Star', '5 Star', 'Highest Class']]
|
135 |
|
136 |
# Reorder the dataframe with selected columns first, created columns next, then the remaining columns
|
137 |
+
df_new = df_new[[review_column, 'Weighted Rating', 'Rating', 'Probability', '1 Star', '2 Star', '3 Star', '4 Star', '5 Star'] + class_names + ['Highest Class'] + remaining_columns]
|
138 |
|
139 |
# Reorder df_display as well
|
140 |
+
df_display = df_display[[review_column, 'Weighted Rating', 'Rating', 'Probability', '1 Star', '2 Star', '3 Star', '4 Star', '5 Star'] + class_names + ['Highest Class'] + remaining_columns]
|
141 |
|
142 |
return df_new, df_display
|
143 |
|