In this tutorial, we'll learn how to drop/delete columns from a pandas dataframe. We are going to walk through three methods to achieve this.
👉 Code for constructing the dataframe:
import pandas as pd
df = pd.DataFrame({'User Name':['Forrest Gump','Mary Jane','Harry Porter','Jean Grey', 'Jean Grey','Mary Jane'],
'Country':['USA','CANDA','UK','CHINA','CANDA','CANDA'],
'City': ['New York','Toronto','London','Shanghai','Montreal','Toronto'],
'Gender':['M','F','M','F','F','F'],
'Age':[50,30,10,30,30,30] })
👉 Text version tutorial:
https://pythoninoffice.com/drop-colum...