Files
hpos-data/scripts/combine4.py

35 lines
1.0 KiB
Python
Raw Normal View History

2023-09-20 19:04:02 +05:30
import pandas as pd
import os
curdir = os.getcwd()
path_delim = '/'
df1 = pd.read_excel(curdir + path_delim + "data/diff_check.xlsx", sheet_name="Sheet3")
# df2 = pd.read_excel(curdir + path_delim + "data/all_users_14_07_2023_to_12_09_2023.xlsx", sheet_name="Sheet2")
# df3 = pd.read_excel(curdir + path_delim + "data/July_Sept3 copy.xlsx", sheet_name="op")
### merging July
### merging July
df = df1.merge(df2, on="_id", how='outer')
# df = pd.concat([df1, df3], ignore_index=True)
print(df)
# sample_ids = df["_id"].tolist()
# print(len(sample_ids))
print(len(df['_id']) - len(df['_id'].drop_duplicates()))
# df_dup = df['_id']-df['_id'].drop_duplicates()
# print(df_dedup)
# dfut = pd.merge(df1, df2, how='outer',
# left_index=True, right_on=['_id', 'Sample ID'],
# indicator=True)
# print(dfut)
# dfut.query('_merge != "both"')
writer = pd.ExcelWriter(curdir + path_delim + "data/July_Sept3.xlsx", engine = 'openpyxl')
df.to_excel(writer, sheet_name = 'op', index=False)
writer.close()