Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
bom_identify
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a7896917
authored
Jun 05, 2020
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
若有多个数量列的判断
parent
5b6ce49d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
predict/dict_predict.py
predict/dict_predict.py
View file @
a7896917
...
...
@@ -130,6 +130,20 @@ class DicPredict(BasePredictor):
for
col_diffrate
in
sort_li_diffrate
[
1
:]:
temp_pre_model_res
.
pop
(
col_diffrate
[
0
])
# 若有多个数量列,则进行空置率的比较, 空置率最低的选为目标列, #TODO 后续可能需要改成数量元素的占比率
prob_num_cols
=
[
i
for
i
in
temp_pre_model_res
if
temp_pre_model_res
[
i
]
==
'数量'
]
if
len
(
prob_num_cols
)
>=
2
:
li_nullrate
=
[]
for
prob_num_col
in
prob_num_cols
:
counter
=
0
for
item
in
dic_data
[
prob_num_col
]:
if
str
(
item
)
.
strip
()
==
self
.
PLACEHOLDER
:
counter
+=
1
li_nullrate
.
append
((
prob_num_col
,
counter
/
len
(
dic_data
[
prob_num_col
])))
sort_li_nullrate
=
sorted
(
li_nullrate
,
key
=
lambda
x
:
x
[
1
])
for
col_nullrate
in
sort_li_nullrate
[
1
:]:
temp_pre_model_res
.
pop
(
col_nullrate
[
0
])
model_id_res
=
{
'std_result'
:
temp_pre_model_res
,
'ab_result'
:
ab_result
,
...
...
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