Professional Documents
Culture Documents
Batch Variable Unit Assignment Using Python Script in Techlog
Batch Variable Unit Assignment Using Python Script in Techlog
Contents
• Problem Statement
Introduction
• Solution
Solution
• Workflow
Workflow
• Limitation
Result
Introduction
• Techlog data harmonization tool may be used to change/convert units for variables
• However, for the case of multiple variable unit assignment, the workflow can be simplified by
using python scripts
• The python script reads an input CSV file and batch changes/converts the variable units in the
project
Solution
• The python script takes an input of a .csv file with the input fields: Variable, Unit_before and
Unit_after
• The following steps are carried out by the script:
• Read the CSV file
• Check if the Unit_before is NULL, change the unit directly
• Check if Unit_before and Unit_after are compatible and convert the units if required
Workflow
1. Open the .csv file and enter the fields Variable, Unit_before and Unit_after
Before After
Well 1 Well 1
Well 2 Well 2
Well 3 Well 3