I am working on a dataframe,
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
---|---|---|---|---|---|---|---|
new_width | new_height | new_depth | audited_Width | audited_Height | audited_Depth | inf | val |
---------- | ----------- | ---------- | -------------- | --------------- | -------------- | --- | --- |
35.00 | 2.00 | 21.00 | 21.00 | 2.50 | 35.00 | T | |
12.00 | 4.40 | 10.60 | 11.60 | 4.40 | 12.00 | T | |
20.50 | 17.00 | 5.50 | 21.50 | 17.05 | 20.50 | F | |
24.33 | 22.00 | 18.11 | 24.00 | 22.05 | 24.33 | T | |
23.00 | 23.00 | 19.00 | 19.00 | 23.00 | 23.00 | F |
Here i want to find difference between rows (0, 3) and (1,4) and (2,5) and verify if the difference value(any one or all the three) falls in the range(0,1), and if yes then it should check the corresponding cell in row 6 and if it is 'T', then print 'YES' in corresponding cell in row 7!
I have the following code:
a=df['new_width'] - df['audited_Width']
for i in a:
if (i in range (0,1))==True:
df['Value'] = 'Yes'
print(df['Value'])
I know that 4th line is incorrect. What alternatives can I use to get the desired output?