赞
踩
- df = pd.read_excel(file_list[i])
-
- # 获取除了'SWC'和'G'列之外的所有列
- columns_to_check = [col for col in df.columns if col not in ["Date","date"]]
-
- for column in df.columns:
- # 检查空值
- if df[column].isnull().any():
- print(f"空值检测:列 '{column}' 存在空值")
-
- # 检查NaN、nan
- if df[column].isin([np.nan, 'NaN', 'nan']).any():
- print(f"NaN检测:列 '{column}' 存在NaN值")
-
- # 检查异常值(可以根据需要修改异常值的判断条件)
- if df[column].apply(lambda x: isinstance(x, str) and not x.isdigit()).any():
- print(f"异常值检测:列 '{column}' 存在非数字的异常值")

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。