方法一:直接del df[‘column-name’]
方法二:采用drop方法,有下面三种等价的表达式
1. df= df.drop(‘column_name’, 1),输入:df,drop(‘num’,axix=1),不改变内存,及输入df的时候,它还是显示原数据
2. df.drop(‘column_name’,axis=1, inplace=True) 输入:df.drop(‘num’,axis=1,inplace=True),改变内存,及输入df的时候,它显示改变后的数据
3. df.drop([df.columns[[0,1, 3]]], axis=1,inplace=True) 输入:df.drop([df.columns[[0,1]]],axis=1,inpalce=True)
此方法暂时无法用