```
# 追加 更新地址n-one
def zhuijia_new():
file_df = pd.read_excel(r"C:\Users\RED\Desktop\122\n-one.xlsx")
file_df['address'] = file_df['ID'].map(lambda x: addrs(int(x)))
file_df.to_csv('new.csv',index=None)
# 追加 更新地址n-one
def zhuijia_old():
file_df = pd.read_excel(r"C:\Users\RED\Desktop\122\n-one.xlsx")
# print(file_df.head(6))
? ? ad = []
for iin file_df['ID']:
addres = addrs(int(i))
ad.append(addres)
file_df['address'] = ad
file_df.to_csv('old.csv',index=None)
```
pandas 中Series的map函數(shù): ————
Series的map方法可以接受一個函數(shù)或含有映射關(guān)系的字典型對象。?
使用map是一種實現(xiàn)元素級轉(zhuǎn)換以及其他數(shù)據(jù)清理工作的便捷方式砌们。?
(DataFrame中對應(yīng)的是applymap()函數(shù)杆麸,當(dāng)然DataFrame還有apply()函數(shù))
如果是2列 就變成 dataframe ?數(shù)據(jù)框了, 使用df.apply()