Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tsoc
DataAnalysis
Commits
471cae9f
Commit
471cae9f
authored
Mar 17, 2026
by
sharkgene@qq.com
Browse files
add new columns
parent
aea23701
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
0 deletions
+12
-0
README.md
README.md
+3
-0
data_config.json
data_config.json
+2
-0
plot_comparison.py
plot_comparison.py
+5
-0
sample.json
sample.json
+2
-0
No files found.
README.md
View file @
471cae9f
...
...
@@ -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: 增加列数据,用于某些文件没有对应信息的,补充处理
参考配置说明:
```
...
...
data_config.json
View file @
471cae9f
...
...
@@ -15,6 +15,8 @@
"column_mapping"
:
{
},
"column_replace"
:
{
},
"column_add"
:
{
}
}
]
...
...
plot_comparison.py
View file @
471cae9f
...
...
@@ -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
}
"
)
...
...
sample.json
View file @
471cae9f
...
...
@@ -23,6 +23,8 @@
"column_mapping"
:
{
"卡类型"
:
"卡型号"
},
"column_replace"
:
{
"模型"
:{
"Qwen3_14B"
:
"Qwen3-14B"
,
"Qwen3_32B"
:
"Qwen3-32B"
}
},
"column_add"
:
{
"prefix cache"
:
"true"
}
}
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment