1. 不包含某一个特征
#取p_feature中不包含列名为index 的所有列
p_feature = p_feature.iloc[:, p_feature.columns != "index"]
2.不包含多个特征
# 包含
p_feature = p_feature.loc[:,p_feature.columns.isin(["index","授信编号"])]
# 加~ 变为不包含
p_feature = p_feature.loc[:,~p_feature.columns.isin(["index","授信编号"])]
拓展: 选取某一列中等于或不等于某个值的df
-
isin()
参考1:https://www.cnblogs.com/nxf-rabbit75/p/10105271.html -
df[~df.col.str.contains(word)]
参考:https://blog.csdn.net/weixin_43368684/article/details/88756103
参考:https://blog.csdn.net/luocheng7430/article/details/80330566