import pandas as pd books = pd.read_excel('e:/Books.xlsx',index_col='ID') for i in books.index: books['Price'].at[i]=books['ListPrice'].at[i]*books['Discount'].at[i] print(books)
import pandas as pd books = pd.read_excel('e:/Books.xlsx',index_col='ID') books['ListPrice']=books['ListPrice'].apply(lambda x:x+2) #也可定义函数 print(books)