When deleting a column in a DataFrame I use:
del df[\'column_name\']
And this works great. Why can\'t I use the following?
Pandas version 0.21 has changed the drop method slightly to include both the index
and columns
parameters to match the signature of the rename
and reindex
methods.
df.drop(columns=['column_a', 'column_c'])
Personally, I prefer using the axis
parameter to denote columns or index because it is the predominant keyword parameter used in nearly all pandas methods. But, now you have some added choices in version 0.21.