26 lines
1.5 KiB
Python
26 lines
1.5 KiB
Python
import pandas as pd
|
|
import os
|
|
|
|
curdir = os.getcwd()
|
|
path_delim = '/'
|
|
df1 = pd.read_excel(curdir + path_delim + "data/6septemberGMC-classified.xlsx", sheet_name="Sheet2")
|
|
df2 = pd.read_excel(curdir + path_delim + "data/6septemberGMC-classified.xlsx", sheet_name="Sheet3")
|
|
# df4 = pd.read_excel(curdir + path_delim + "homecare-center-03sep-final.xlsx", sheet_name="Sheet4")
|
|
|
|
df = df1.merge(df2, on="_id")
|
|
# df = df.merge(df4, on="_id")
|
|
df['Age'] = 2023 - df['birthYear']
|
|
print(df)
|
|
|
|
df = df[["_id", "name", "abhaId", "aadharId", "Age", "gender", "category", "maritalStatus", "house", "district", "state", "pinCode", "phoneNumber", "Classification", "bloodGroup"]]
|
|
print(df)
|
|
|
|
# df = df.sort_values(by=['testTime'], ascending=True)
|
|
|
|
df.rename(columns={'_id': "Sample ID", "name": "Name", "abhaId": "ABHA ID", "aadharId": "Aadhaar ID", "gender": "Gender", "category": "Category", "maritalStatus": "Marital Status", "house": "Address", "district": "District", "state": "State", "pinCode": "Pincode", "phoneNumber": "Mobile Number", "Classification": "Test Result", "bloodGroup": "Blood Group"}, inplace = True)
|
|
df = df.reindex(["Sample ID", "Name", "ABHA ID", "Aadhaar ID", "Age", "Gender", "Category", "Marital Status", "Address", "District", "State", "Pincode", "Mobile Number", "Test Result", "Blood Group"], axis=1)
|
|
print(df)
|
|
|
|
writer = pd.ExcelWriter(curdir + path_delim + "data/6septemberGMC - classified-combined.xlsx", engine = 'openpyxl')
|
|
df.to_excel(writer, sheet_name = 'op', index=False)
|
|
writer.close() |