遇见的问题
np.nan被strip之后仍为nan,但是此nan无法被.fillna()处理,处理后仍然为nan
get_address_local_mail['CountryID_mail'] = get_address_local_mail['CountryID_mail'].apply(lambda x: np.nan if x == "00000000-0000-0000-0000-000000000000" or x == "NULL" else x) get_address_local_mail['CountryID_local'] = get_address_local_mail['CountryID_local'].apply(lambda x: np.nan if x == "00000000-0000-0000-0000-000000000000" or x == "NULL" else x) for column in get_address_local_mail.columns: get_address_local_mail[column] = get_address_local_mail[column].astype(str).str.strip() get_address_local_mail = get_address_local_mail.fillna('')
此时打印结果仍然是nan.
影响后续结果判断
先fillna()后试一下,显示结果中不再显示nan
标签:0000,get,nan,address,Excel,strip,mail,fillna,local From: https://www.cnblogs.com/woniuguoguo/p/18456789