import pandas as pd
df = pd.read_excel("销售信息汇总表.xlsx")
df_data = pd.DataFrame(columns=["销售金额","销售数量","总体客户消费平均金额"])
df_data[["销售金额","销售数量"]] = df
df_data["总体客户消费平均金额"]= df_data.apply(lambda x: x["销售金额"] / x["销售数量"], axis=1)
运行后报错:
ValueError: Cannot set a frame with no defined index and a value that cannot be converted to a Series
求解;