How to drop multiple columns in python?
![](https://pythonpoint.net/wp-content/uploads/2020/12/Green-and-Black-Illustrated-Video-Game-Controller-Vector-YouTube-Channel-Cover-2-1024x576.jpg)
In python, we have data of many columns and rows. And we want to show only some columns off that data. Then what will we do.
We have a drop() function which help in dropping columns in the data.
e.g.,
import pandas as pd data = { 'A':['1', '2', '3', '4', '5'], 'B':['1', '2', '3', '4', '5'], 'C':['1', '2', '3', '4', '5'], 'D':['1', '2', '3', '4', '5'], 'E':['1', '2', '3', '4', '5'] } df = pd.DataFrame(data) print(df) df.drop(['A','C'], axis = 1) print(df)
![](https://pythonpoint.net/wp-content/uploads/2020/12/Screenshot-999-1024x574.png)
This is how we can drop columns in python.
Subscribe
Login
Please login to comment
0 Discussion