UnboundLocalError: local variable 'file_path' referenced before assignment
banderlog opened this issue · 0 comments
banderlog commented
The following code throws an error:
from mimic_fhir_transformation import transform_table
data_path = './data/mimic-iii-clinical-database-1.4/'
output_path = './data/test/'
patient_fhir = transform_table(os.path.join(data_path, 'PATIENTS.csv.gz'),
os.path.join(data_path, 'ADMISSIONS.csv.gz'),
output_path)
And the source of error:
def transform_table(table_file_path, output_path, auxiliary_table_path=''):
if Path(table_file_path).suffix == '':
file_path = Path(table_file_path).stem
if Path(file_path).name == 'ADMISSIONS.csv':
df = transform_admissions(table_file_path, output_path)
...
If Path(table_file_path).suffix != ''
, then you have no file_path
at all