CSV1:
Name Gender Sl_no
Abc f 5
xyx m 10
hhh f 20
csv2:
Sl_no Name Gender
10 bla bla
5 bla bla
Here I only care about the sl_no
column, which is in a different index in both the tables and i only need the missing value in cs2 sl_no
. How do i do this using python
CodePudding user response:
You could use loc
with isin
.
import pandas as pd
csv1 = pd.read_csv('path/to/csv1')
csv2 = pd.read_csv('path/to/csv2')
missing = csv1.loc[~csv1['Sl_no'].isin(csv2['Sl_no']), 'Sl_no']
print(missing)