Files
hpos-data/scripts/combine_hemocube_denovix.py

26 lines
1.5 KiB
Python
Raw Normal View History

2023-09-04 07:43:03 +05:30
import pandas as pd
import os
curdir = os.getcwd()
path_delim = '/'
2023-09-07 18:04:46 +05:30
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")
2023-09-05 11:15:53 +05:30
# df4 = pd.read_excel(curdir + path_delim + "homecare-center-03sep-final.xlsx", sheet_name="Sheet4")
2023-09-04 07:43:03 +05:30
df = df1.merge(df2, on="_id")
2023-09-05 11:15:53 +05:30
# df = df.merge(df4, on="_id")
2023-09-04 07:43:03 +05:30
df['Age'] = 2023 - df['birthYear']
print(df)
2023-09-07 18:04:46 +05:30
df = df[["_id", "name", "abhaId", "aadharId", "Age", "gender", "category", "maritalStatus", "house", "district", "state", "pinCode", "phoneNumber", "Classification", "bloodGroup"]]
2023-09-04 07:43:03 +05:30
print(df)
# df = df.sort_values(by=['testTime'], ascending=True)
2023-09-07 18:04:46 +05:30
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)
2023-09-04 07:43:03 +05:30
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)
2023-09-07 18:04:46 +05:30
writer = pd.ExcelWriter(curdir + path_delim + "data/6septemberGMC - classified-combined.xlsx", engine = 'openpyxl')
2023-09-04 07:43:03 +05:30
df.to_excel(writer, sheet_name = 'op', index=False)
writer.close()