how to select 2 columns in pandas code example
Example 1: pandas iloc select certain columns
dataframe.iloc[:,[1,2]]
Example 2: python pandas selecting multiple columns
import pandas as pd
data = {'Name':['Jai', 'Princi', 'Gaurav', 'Anuj'],
'Age':[27, 24, 22, 32],
'Address':['Delhi', 'Kanpur', 'Allahabad', 'Kannauj'],
'Qualification':['Msc', 'MA', 'MCA', 'Phd']}
df = pd.DataFrame(data)
df[['Name', 'Qualification']]
Example 3: select 2 cols from dataframe python pandas
df = pd.DataFrame(data)
df[['Name', 'Qualification']]