Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -125,6 +125,7 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
|
|
125 |
columns = [c for c in columns if c not in always_here_cols]
|
126 |
# 'always_here_cols' を先頭に追加し、その他のカラムを COLS の順序で追加
|
127 |
new_columns = always_here_cols + [c for c in COLS if c in df.columns and c in columns]
|
|
|
128 |
# 重複を排除しつつ順序を維持
|
129 |
seen = set()
|
130 |
unique_columns = []
|
@@ -132,10 +133,16 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
|
|
132 |
if c not in seen:
|
133 |
unique_columns.append(c)
|
134 |
seen.add(c)
|
|
|
|
|
|
|
|
|
|
|
135 |
# フィルタリングされたカラムでデータフレームを作成
|
136 |
filtered_df = df[unique_columns]
|
137 |
return filtered_df
|
138 |
|
|
|
139 |
def filter_queries(query: str, filtered_df: pd.DataFrame):
|
140 |
"""Added by Abishek"""
|
141 |
final_df = []
|
|
|
125 |
columns = [c for c in columns if c not in always_here_cols]
|
126 |
# 'always_here_cols' を先頭に追加し、その他のカラムを COLS の順序で追加
|
127 |
new_columns = always_here_cols + [c for c in COLS if c in df.columns and c in columns]
|
128 |
+
|
129 |
# 重複を排除しつつ順序を維持
|
130 |
seen = set()
|
131 |
unique_columns = []
|
|
|
133 |
if c not in seen:
|
134 |
unique_columns.append(c)
|
135 |
seen.add(c)
|
136 |
+
|
137 |
+
# 'Model' カラムがHTMLリンクでない場合を選択
|
138 |
+
if 'Model' in df.columns:
|
139 |
+
df['Model'] = df['Model'].apply(lambda x: x if isinstance(x, str) and not x.startswith('<a') else '')
|
140 |
+
|
141 |
# フィルタリングされたカラムでデータフレームを作成
|
142 |
filtered_df = df[unique_columns]
|
143 |
return filtered_df
|
144 |
|
145 |
+
|
146 |
def filter_queries(query: str, filtered_df: pd.DataFrame):
|
147 |
"""Added by Abishek"""
|
148 |
final_df = []
|