Spaces:
Running
Running
auto update for selected cols
Browse files
app.py
CHANGED
@@ -114,16 +114,14 @@ def _group_by_question(df_in: pd.DataFrame) -> pd.DataFrame:
|
|
114 |
.rename(columns={"country": "Countries", "year": "Years", "answer_text": "Sample Answers"})
|
115 |
)
|
116 |
return grouped
|
117 |
-
|
118 |
-
def _selected_cols(has_score
|
119 |
-
allowed = set(
|
|
|
|
|
120 |
cols = [c for c in w_columns.value if c in allowed]
|
121 |
-
if has_score and "Score" in w_columns.value:
|
122 |
-
cols = ["Score"] + cols
|
123 |
if not cols:
|
124 |
-
cols = ["country","year","question_text","answer_text"]
|
125 |
-
if has_score and "Score" in w_columns.options:
|
126 |
-
cols = ["Score"] + cols
|
127 |
return cols
|
128 |
|
129 |
|
|
|
114 |
.rename(columns={"country": "Countries", "year": "Years", "answer_text": "Sample Answers"})
|
115 |
)
|
116 |
return grouped
|
117 |
+
|
118 |
+
def _selected_cols(has_score=False):
|
119 |
+
allowed = set(ALL_COLUMNS)
|
120 |
+
if not has_score and "Score" in w_columns.value:
|
121 |
+
w_columns.value = [c for c in w_columns.value if c != "Score"]
|
122 |
cols = [c for c in w_columns.value if c in allowed]
|
|
|
|
|
123 |
if not cols:
|
124 |
+
cols = ["country", "year", "question_text", "answer_text"]
|
|
|
|
|
125 |
return cols
|
126 |
|
127 |
|