Sajjad
0
Q:

how to select two columns in a dataframe

#suppose you have two dataframes df1 and df2, and 
#you need to merge them along the column id
df_merge_col = pd.merge(df1, df2, on='id')
1
# Import pandas package 
import pandas as pd 
  
# Define a dictionary containing employee data 
data = {'Name':['Jai', 'Princi', 'Gaurav', 'Anuj'], 
        'Age':[27, 24, 22, 32], 
        'Address':['Delhi', 'Kanpur', 'Allahabad', 'Kannauj'], 
        'Qualification':['Msc', 'MA', 'MCA', 'Phd']} 
  
# Convert the dictionary into DataFrame  
df = pd.DataFrame(data) 
  
# select two columns 
df[['Name', 'Qualification']] 
0

New to Communities?

Join the community