Delete a column from a Pandas DataFrame
The best way to do this in Pandas is to use drop: df = df.drop(‘column_name’, 1) where 1 is the axis number (0 for rows and 1 for columns.) To delete the column without having to reassign df you can do: df.drop(‘column_name’, axis=1, inplace=True) Finally, to drop by column number instead of by column label, … Read more