Commit a7896917 by lichenggang

若有多个数量列的判断

parent 5b6ce49d
Showing with 14 additions and 0 deletions
...@@ -130,6 +130,20 @@ class DicPredict(BasePredictor): ...@@ -130,6 +130,20 @@ class DicPredict(BasePredictor):
for col_diffrate in sort_li_diffrate[1:]: for col_diffrate in sort_li_diffrate[1:]:
temp_pre_model_res.pop(col_diffrate[0]) 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 = { model_id_res = {
'std_result': temp_pre_model_res, 'std_result': temp_pre_model_res,
'ab_result': ab_result, 'ab_result': ab_result,
......
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 sign in to comment