Skip to main content

Posts

Showing posts with the label 8.Write a Pandas program to join the two given dataframes along columns and assign all data.

ads1

8.Write a Pandas program to join the two given dataframes along columns and assign all data.

8.Write a Pandas program to join the two given dataframes along columns and assign all data. Solution :-  import pandas as pd import numpy as np exam_dic1 = {'name':['abc','xyz','pqr','mno','asd'],              'perc':[85,89,82,63,25],              'qualify':['yes','yes','yes','yes','no']} exam_data1 = pd.DataFrame(exam_dic1) exam_dic2 =  {'name':['abc1','xyz1','pqr1','mno1','asd1'],              'perc':[85,79,82,43,25],              'qualify':['yes','yes','yes','yes','no']} exam_data2 = pd.DataFrame(exam_dic2) print("The Original Data Frame :- ") print(exam_data1) print("---------------------") print(exam_data2) print("Join the Two DataFrame") result_data = pd.concat([exam_data1 , exam_data2],axis = 1) print(result_data) Output :- 

ads2