Gabriel00A commited on
Commit
e304a12
·
verified ·
1 Parent(s): 2b0a6be

Update process_report.py

Browse files
Files changed (1) hide show
  1. process_report.py +8 -0
process_report.py CHANGED
@@ -124,6 +124,14 @@ def read_system_export(path: str) -> pd.DataFrame:
124
  df[c] = pd.to_numeric(df[c], errors="coerce").fillna(0)
125
 
126
  df = df.dropna(how="all")
 
 
 
 
 
 
 
 
127
  return df
128
 
129
  def _first_nonnull(series: pd.Series):
 
124
  df[c] = pd.to_numeric(df[c], errors="coerce").fillna(0)
125
 
126
  df = df.dropna(how="all")
127
+
128
+ # ====== 新增代码:开始 ======
129
+ # 增加清洗:如果一行连“请购单号”或“物料编码”这种关键ID都没有,则删除
130
+ key_cols_to_check = [c for c in ["请购单号", "物料编码"] if c in df.columns]
131
+ if key_cols_to_check:
132
+ df = df.dropna(subset=key_cols_to_check, how='all')
133
+ # ====== 新增代码:结束 ======
134
+
135
  return df
136
 
137
  def _first_nonnull(series: pd.Series):