由于“ AttributeError:'NoneType'对象没有属性'to_csv'”而出现错误

时间:2019-10-11 17:14:48

标签: python-3.x

我正在本地运行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中保存一个新文件,并在其中删除两列

0 个答案:

没有答案