Delete one or more columns of Pandas Dataframe:
method One : Direct del df[' Column-name ']
method Two : Using the Drop method, there are three types of equivalent expressions:
1. df= df.drop (' column_name ', 1);
2. Df.drop (' column_name ', Axis=1, Inplace=true)
3. Df.drop ([df.columns[[0,1, 3]], axis=1,inplace=true) # Note:zero indexed
Note : Usually there is a inplace optional parameter that modifies the original array and returns a new array. If set to True manually (the default is False), then the original array is replaced directly. That is, after using Inplace=true, the original array name (as shown in 2 and 3) corresponds to the corresponding memory value changes directly, and after the use of Inplace=false, the original array name corresponding memory value does not change, You need to assign the new result to a new array or overwrite the memory location of the original array (as shown in 1).
Reference: http://blog.sciencenet.cn/home.php?do=blog&id=884388&mod=space&uid=645086
How Python Deletes a pandas dataframe column