Created
August 26, 2022 00:36
-
-
Save matthewchung74/f454541f563431931d610fe7396fc7e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#read all files, concat | |
from pathlib import Path | |
import pandas as pd | |
pathlist = Path('./Reports_Base').glob('*.tsv') | |
df_array = [] | |
for path in pathlist: | |
df = pd.read_csv(path, sep='\t', encoding='iso-8859-1') | |
df_array.append(df) | |
df = pd.concat(df_array) | |
#rename columns to our column names | |
df = df.rename(columns={ | |
'Patient_Sex': 'gender', | |
'Pacient_Age_Anonym': 'age', | |
'Exam_Data': 'exam_date', | |
'Modality_PACS': 'modality_pacs', | |
'Exams_Description_PACS' : 'orig_exam_description', | |
'Exams_Body_Part' : 'orig_body_part', | |
'Modality_FIDI': 'modality_pacs_fidi', # ??? | |
'Exams_Description_FIDI' : 'exam_desc_fidi', | |
'Flag_Bedridden' : 'is_bedridden', | |
'REPORT' : 'report_text', | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment