Integrating Data

1. Loading the data for "student.csv" and "mark.csv"

In [2]:
import pandas as pd
import numpy as np

student = pd.read_csv("student.csv",header=0)
In [3]:
student.head()
Out[3]:
Student_id Age Gender Grade Employed
0 1 19 Male 1st Class yes
1 2 20 Female 2nd Class no
2 3 18 Male 1st Class no
3 4 21 Female 2nd Class no
4 5 19 Male 1st Class no
In [4]:
mark = pd.read_csv("mark.csv",header=0)
In [5]:
mark.head()
Out[5]:
Student_id Mark City
0 1 95 Chennai
1 2 70 Delhi
2 3 98 Mumbai
3 4 75 Pune
4 5 89 Kochi

2. Merging the 2 dataset on the "Student_id" column

In [6]:
df_merge = pd.merge(student,mark, on = 'Student_id')
In [7]:
df_merge.head()
Out[7]:
Student_id Age Gender Grade Employed Mark City
0 1 19 Male 1st Class yes 95 Chennai
1 2 20 Female 2nd Class no 70 Delhi
2 3 18 Male 1st Class no 98 Mumbai
3 4 21 Female 2nd Class no 75 Pune
4 5 19 Male 1st Class no 89 Kochi