I am running a script looking at a dataset,
The code in question is this…
if labelName == ‘DEFECT LABEL 3’:
return pyData[0][0]
if labelName == ‘DEFECT LABEL 4’:
return pyData[1][0]
if labelName == ‘DEFECT LABEL 5’:
return pyData[2][0]
it works great, but sometimes my data set won’t have as many rows as I have if statements.
How can I say -
if pyData[1][0] is out of range:
return ‘NA’
else:
return pyData[1][0]
Thank you…