I want to compare some values using "if" in the code below, but it doesn't work:
if Slice_num[person][i, [1]] == Z_pos: # Slice_num[0][15, [1]] is ['-10.000000'] and Z_pos = -10.000000
absname = os.path.join(root, dcmfile)
Example: Values in the above variables are equal:
Z_pos: -10.000000 , <class 'pydicom.valuerep.DSfloat'>
Slice_num[person][i, [1]]: ['-10.000000'] , <class 'numpy.ndarray'>
So, when the code is performed, if
statement cannot be applied and the next line after if
statement cannot be run. while the value (-10.000000) is same in both of them.
How can the problem be solved, so that if
statement find them equal?