#ataB7=dataB7applylambda x 0 if x==#NULL!newB7=for i in dataB7; if i==#NULL!; newB7append0 else newB7appendidataB7=pdSeriesnewB7中文解释每行代码的意思
#ata['B7']=data['B7'].apply(lambda x: 0 if x=='#NULL!') #将data中'B7'列中的'#NULL!'替换为0,并赋值给ata中的'B7'列
newB7=[] #创建一个空列表newB7
for i in data['B7']: #遍历data中的'B7'列 if i=='#NULL!': #如果值为'#NULL!' newB7.append(0) #将0添加到newB7列表中 else: newB7.append(i) #否则将原值添加到newB7列表中
data['B7']=pd.Series(newB7) #将newB7列表转换为pandas中的Series类型,并赋值给data中的'B7'列
原文地址: https://www.cveoy.top/t/topic/hsls 著作权归作者所有。请勿转载和采集!