I am a beginner in python as well as in Pandas and I want to extract lines which are not matching in both the sheets based on column called "KeyValue" and that column value is the concat of columns ('WeekStartDate','EmployeeName','ScheduleType','Day1','CenterCode') in both the sheets.
However I am getting no merged values, it shows values from both DFs on top of each other despite having common Column & value in it. here is my code and result. Any help will be highly appreciated.
import pandas as pd
import numpy as np
df = pd.read_csv('Vinay1.csv')
#print(df.info())
df1 = pd.read_csv('Maddy1.csv')
#print(df1.info())
Test1 = pd.merge(df, df1, on='KeyValue', how='outer')
#Test1.to_csv('MergedData1.csv')
print(Test1)
Test1.to_csv('MergedData2.csv')
================================================================
Output:
Unnamed: 0_x RowID ... WeekStartDate_y Day1_y
0 0.0 1.0 ... NaN NaN
1 1.0 2.0 ... NaN NaN
2 2.0 3.0 ... NaN NaN
3 3.0 4.0 ... NaN NaN
4 4.0 5.0 ... NaN NaN
.. ... ... ... ... ...
194 NaN NaN ... 10-01-2022 11:00AM-05:00PM
195 NaN NaN ... 10-02-2022 10:00AM-05:00PM
196 NaN NaN ... 10-01-2022 09:00AM-05:00PM
197 NaN NaN ... 10-02-2022 10:00AM-05:00PM
198 NaN NaN ... NaN NaN
[199 rows x 28 columns]
[Finished in 0.7s]
Note: here are the two CSV sheets that I am using to compare & merge. I was using
Update: I tried a lot, however, could not share the sample csv and result csv here :( Hence, please find the sample data & result by clicking below the G-drive link. https://drive.google.com/drive/folders/10wkH8LIHwb7kZk2TF-c-V4ZZb9HXTCa_?usp=sharing