Q. A dataframe Result stores the details as (Rollno., marks). Write a program to join it with a dataframe Stu storing details as (Name, Class, Subject). Make sure that all the rows from both the dataframes are part of the resultant dataframe.


Answer =

 



import pandas as pd
import numpy as np

result = pd.DataFrame( { "rollno" : [11, 7, 6, 1, 10, 7, 11], \
                    "marks" : [11, 12, 13, 14, 15, 16, 17] } )

stu = pd.DataFrame( { "Name" : [ "Name1", "Name2", "Name3", "Name4", \
                            "Name6", "Name7", "Name8" ],"Subject" : [16, 25, 21, 15, 18, 14, 10], \
                      "class" : [11, 12, 13, 14, 15, 16, 17] } )

print( result.join(stu) )



Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post