我正在本地运行python代码。执行时,它给我错误
AttributeError:“ NoneType”对象没有属性“ to_csv”。
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sb
import sklearn as sl
df =pd.read_csv(r'F:\Data science\house-prices-advanced-regression-techniques\train.csv')
df.set_index('Id')
df1=df.drop(['PoolQC','Fence'],axis = 1, inplace = True)
df.to_csv(r'F:\Data science\house-prices-advanced-regression-techniques\df_t1.csv')
期望在csv中保存一个新文件,并在其中删除两列