I would like something that looks like this :
for elements in ref_series_list:
z = 100
if len(ref_series_list)>=1:
if z_voxel_size in Series_table.at[elements, 'z_voxel_size']<z:
z_min = z_voxel_size
df1.at[elements, 'ref_series_id'] = df2.ID[elements][z_voxel_size]
The part if z_voxel_size in Series_table.at[elements, 'z_voxel_size'] < z
doesn't work because it says 'Numpy.float64' object is not iterable.
The elements
in list represent ID that are in df2
and I would like to keep the element that has the lowest z_voxel_size
in the df2
corresponding to the ID.
My list is [8,9]. The 8 correspond to the ID 8 in column ID in df2 and has a z_voxel_size of 1.25 in the column z_voxel_size of df2 and the 9 correspond to the ID 9 in column ID in df2 and has a z_voxel_size of 0.625 in the column z_voxel_size of df2. So I would like that my list contains only 9 and not 8 and after store this 9 in a new dataframe df1.