I am trying to use an If statement with a Dataframe. Without the If statement the Dataframe prints out beautifully, But it prints out all 63 rows. I am trying to check if field in Dataframe matched user input. Can someone tell me what I am doing wrong?
def load_track_to_Handi(): my_tracklabel= Label(root, text =" ", fg= "#F50808", font = ("sans_serif" , 16)).place(x=380, y=430) read_csvfile_into_array() global track_abrev global race_number global xx #if fileFound ==True: hcount = 0 with open( 'C://guis/f_racefiles/'+ track_abrev + '.csv' , 'r') as race_file: df = pd.read_csv(race_file, header =None) xx = df.iloc[ :,0:19 ].values for i in range(0,len(xx)): if (xx[hcount][1] == race_number): print(xx)[hcount][18]) hcount+=1I remove if statement and prints out with no problem. Race number is an integer and I believe the field in the dataframe is an interger also, as it is a race number.