Commit 471cae9f authored by sharkgene@qq.com's avatar sharkgene@qq.com
Browse files

add new columns

parent aea23701
......@@ -21,6 +21,8 @@
"column_mapping": {
},
"column_replace": {
},
"column_add": {
}
}
]
......@@ -36,6 +38,7 @@ files: 指定文件信息, 可以使用多个文件(可以参考sample.json)
sheets: 可以指定处理的sheet,不指定则遍历所有
column_mapping: 列名重映射,用于处理多个文件时表头信息略有差异的情况, 其他字段以重映射后的名字为准
column_replace: 数据替换,用于处理不同文件命名规则不一致的情形, 过滤数据内容以替换后的为准
column_add: 增加列数据,用于某些文件没有对应信息的,补充处理
参考配置说明:
```
......
......@@ -15,6 +15,8 @@
"column_mapping": {
},
"column_replace": {
},
"column_add": {
}
}
]
......
......@@ -23,6 +23,7 @@ def load_data_from_files(config):
file_path = file_config.get('file')
sheets = file_config.get('sheets', [])
column_mapping = file_config.get('column_mapping', {})
column_add = file_config.get('column_add', {})
if not os.path.exists(file_path):
print(f"文件不存在: {file_path}, 跳过")
......@@ -52,6 +53,10 @@ def load_data_from_files(config):
df['source_sheet'] = sheet
all_data.append(df)
print(f"读取: {file_path} - {sheet}, {len(df)} 行")
for c in column_add:
df[c] = column_add[c]
except Exception as e:
print(f"读取失败: {file_path} - {sheet}: {e}")
......
......@@ -23,6 +23,8 @@
"column_mapping": {"卡类型":"卡型号"
},
"column_replace": {"模型":{"Qwen3_14B":"Qwen3-14B", "Qwen3_32B":"Qwen3-32B"}
},
"column_add": {"prefix cache": "true"
}
}
]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment