0

I'm trying to compare 3 different arrays to create an output where if the value of the three arrays is below 30, then the output is 1, if one of above 30, then the output to be 0. I want to create a resulting array of 1's and 0's, however I keep getting the error -

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().

Am I just way off on my coding? I've only been coding for 2 days so I don't have a large idea about what I'm doing.

#loop through each row of the array
for row in UrbanArray:
    #loop through each value in the current row
    for v in row.flat:
        if (UrbanArray < 30 and AgArray < 30 and NatArray < 30):
            tmpList.append(1)
        else:
            tmpList.append(0)
4

0 回答 0