Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -57,9 +57,32 @@ class EmbeddingsSearch:
|
|
| 57 |
]
|
| 58 |
return results
|
| 59 |
|
| 60 |
-
xls = pd.ExcelFile('SmartClever table explanations updated.xlsx')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
metadata_df = pd.DataFrame()
|
| 62 |
i = 0
|
|
|
|
| 63 |
sheet_to_df_map = {}
|
| 64 |
for k, sheet_name in enumerate(xls.sheet_names):
|
| 65 |
if k > 0:
|
|
@@ -75,7 +98,7 @@ for k, sheet_name in enumerate(xls.sheet_names):
|
|
| 75 |
i += 1
|
| 76 |
|
| 77 |
metadata_df2 = xls.parse('Table explanations',header=1).dropna(axis=0,how='all').dropna(axis=1,how='all')
|
| 78 |
-
metadata_df2.columns = ['table','metadata']
|
| 79 |
metadata_df2.table = metadata_df2.table.apply(lambda x: x.strip())
|
| 80 |
metadata_df = pd.merge(metadata_df, metadata_df2, how='inner')
|
| 81 |
|
|
|
|
| 57 |
]
|
| 58 |
return results
|
| 59 |
|
| 60 |
+
#xls = pd.ExcelFile('SmartClever table explanations updated.xlsx')
|
| 61 |
+
#metadata_df = pd.DataFrame()
|
| 62 |
+
#i = 0
|
| 63 |
+
#sheet_to_df_map = {}
|
| 64 |
+
#for k, sheet_name in enumerate(xls.sheet_names):
|
| 65 |
+
# if k > 0:
|
| 66 |
+
# sheet_to_df_map[sheet_name.strip()] = xls.parse(sheet_name, header=None)
|
| 67 |
+
# sheet_to_df_map[sheet_name.strip()].columns = sheet_to_df_map[sheet_name.strip()].iloc[1]
|
| 68 |
+
# sheet_to_df_map[sheet_name.strip()] = sheet_to_df_map[sheet_name.strip()].iloc[:1].fillna('')
|
| 69 |
+
# sheet_to_df_map[sheet_name.strip()]['metadata'] = sheet_to_df_map[sheet_name.strip()].apply(lambda x: \
|
| 70 |
+
# ". ".join([x[col] for col in sheet_to_df_map[sheet_name.strip()].columns]), axis=1)
|
| 71 |
+
|
| 72 |
+
# metadata_df.loc[i, "table"] = sheet_name.strip()
|
| 73 |
+
# metadata_df.loc[i, "desc"] = sheet_to_df_map[sheet_name.strip()]['metadata'].iloc[0]
|
| 74 |
+
#
|
| 75 |
+
# i += 1
|
| 76 |
+
|
| 77 |
+
#metadata_df2 = xls.parse('Table explanations',header=1).dropna(axis=0,how='all').dropna(axis=1,how='all')
|
| 78 |
+
#metadata_df2.columns = ['table','metadata']
|
| 79 |
+
#metadata_df2.table = metadata_df2.table.apply(lambda x: x.strip())
|
| 80 |
+
#metadata_df = pd.merge(metadata_df, metadata_df2, how='inner')
|
| 81 |
+
|
| 82 |
+
xls = pd.ExcelFile('SmartClever table explanations_V3.xlsx')
|
| 83 |
metadata_df = pd.DataFrame()
|
| 84 |
i = 0
|
| 85 |
+
|
| 86 |
sheet_to_df_map = {}
|
| 87 |
for k, sheet_name in enumerate(xls.sheet_names):
|
| 88 |
if k > 0:
|
|
|
|
| 98 |
i += 1
|
| 99 |
|
| 100 |
metadata_df2 = xls.parse('Table explanations',header=1).dropna(axis=0,how='all').dropna(axis=1,how='all')
|
| 101 |
+
metadata_df2.columns = ['table','nickname','metadata']
|
| 102 |
metadata_df2.table = metadata_df2.table.apply(lambda x: x.strip())
|
| 103 |
metadata_df = pd.merge(metadata_df, metadata_df2, how='inner')
|
| 104 |
|