Write a python as a whole. I have an excel (*.xlsx) with list of data in column A to G…
- User
Write a python as a whole. I have an excel (*.xlsx) with list of data in column A to G in C:\Users\gnulch2\Desktop\Temp\Collated ALL.xlsx
Header as follows: Column A = Case No Column B = Document Name Column C = Document Item Name Column D = Authored Date (YYYYMMDD) Column E = Authored Time Column F = Value Text Column G = User ID
This list of excel is a dataset which consist of column A being the case no for each hospital case, and what type of fields is being entered by the staff, which represented by column C and the value the staff entered, which represented by column F.
Under Column C, these are the list of possible data: SHS_OT_NUR_ASCDay_DischDT_DTM SHS_OT_NUR_ASCDay_AL SHS_OT_NUR_ASCDay_AL2 SHS_OT_NUR_ASCDay_AL3 SHS_OT_NUR_ASCDay_AL4 SHS_OT_NUR_ASCDay_BP/PR20% SHS_OT_NUR_ASCDay_BP/PR20%_2 SHS_OT_NUR_ASCDay_BP/PR20%_3 SHS_OT_NUR_ASCDay_BP/PR20%_4 SHS_OT_NUR_ASCDay_scoreCalcu_NUM SHS_OT_NUR_ASCDay_scoreCalcu_NUM2 SHS_OT_NUR_ASCDay_scoreCalcu_NUM3 SHS_OT_NUR_ASCDay_scoreCalcu_NUM4 SHS_NUR_OT_PADSS_ChrTXT SHS_OT_NUR_ASCDay_PA1 SHS_OT_NUR_ASCDay_PA2 SHS_OT_NUR_ASCDay_PA3 SHS_OT_NUR_ASCDay_PA4 SHS_OT_NUR_ASCDay_SB1 SHS_OT_NUR_ASCDay_SB2 SHS_OT_NUR_ASCDay_SB3 SHS_OT_NUR_ASCDay_SB4
Column C is link to the data in Column F.
Task:
-
Create the next available Column for each of possible data option from Column C without deleting any information on that sheet. e.g. SHS_OT_NUR_ASCDay_DischDT_DTM in Column H, SHS_OT_NUR_ASCDay_AL in Column I, etc
-
Copy the value from column F to the corresponding column that reflect in Column C. Please note to copy column F value on the first occurance of the case number if case number repeat subsequently. e.g. If in row 2, Column A is '1234567B', Column C is SHS_OT_NUR_ASCDay_DischDT_DTM, and Column F is '1' then Copy '1' to Column H using above rule. If in row 3, Column A is '1234567B', Column C is SHS_OT_NUR_ASCDay_AL, and Column F is '2', then copy Column F '2' to Column H row 2.
Save the excel in C:\Users\gnulch2\Desktop\Temp\Output.xlsx
-
- Assistant