import pandas as pd
#读取文件
books = pd.read_excel("C:/Users/asus\Downloads/Books (1).xlsx",index_col="ID")
#获取列
# books["Price"] = books["ListPrice"] *books["Discount"]
#列二
# for i in books.index:
# books["Price"].at[i] = books["ListPrice"].at[i] * books["Discount"].at[i]
books["ListPrice"] = books["ListPrice"].apply(lambda x:x+2)
print(books)
pandas函数填充
最新推荐文章于 2024-04-22 10:35:14 发布