This is the loop I am using.
lines = []
for dicom in mydicoms:
dcm1 = pydicom.dcmread(dicom)
identity = dcm1.PatientID
age = dcm1.PatientAge
sex = dcm1.PatientSex
modality = dcm1.Modality
finding = dcm1.StudyDescription
rows = dcm1.Rows
columns = dcm1.Columns
new_row = {'id':identity, 'age':age, 'sex':sex, 'modality':modality, 'finding':finding, 'rows':rows, 'columns':columns}
df.append(new_row, ignore_index = True)
lines.append(new_row)
When I check the data frame later it is empty.
When I take a part of the code and run it in another cell of jupyter:
df.append(new_row, ignore_index=True)
df.append(lines, ignore_index = True)
It works correctly but inside the loop its not working why?