When inplace = True
, the data is modified in place, which means it will return nothing and the dataframe is now updated. When inplace=False
, you will need to assign it to something new.
Change your code from:
X = df.drop('Purchase',axis=1,inplace=True)
To this:
df.drop('Purchase',axis=1,inplace=True)
Or, alternatively use inplace=False
(which is the default) and returns a copy of the object, and use:
X = df.drop('Purchase',axis=1)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…