-1

I'm simply trying to determine if my tuple has empty inputs. I'm reading Data from an Excel Sheet and it gives tuples in the form

(3,4,6), (3,4,7)

so basically it typically has 3 parameters but there are some cells that don't include the first or second parameter, so technically it would be

('','',6)

In my code I have set up as:

for i in range(len(self.listOfTuples)):
    for j in range(len(self.listOfTuples[i])):
        if(self.listOfTuples[i][j][0] == '' or self.listOfTuples[i][j][1] == ''):
            print("GOT IT ")

and it's not printing my statement, when I print out the self.listofTuples[i][j][0]. It actually prints out nan, but when I change my if statement with "nan" it still doesn't print out my statement. Is there something i'm missing ?

rahlf23
  • 8,869
  • 4
  • 24
  • 54
Jeff Pernia
  • 79
  • 1
  • 13

1 Answers1

1

nan is "not-a-number". You can detect it with math.isnan(self.listOfTuples[i][j][0]).

DYZ
  • 55,249
  • 10
  • 64
  • 93