ValueError:invalid literal for int() with base 10: 'No'' Trying to do a binary classification and have the class names as string but when it gives me the error mentioned in the title. I tried to give integer labels as 0 and 1, the code works perfectly fine. I tried all the suggestions from stackoverflow regarding the same error but nothing is working.Here is the code snippet: 

labels = ["No", "priorlocaltx"]
#labels = [0, 1]
keyword_identifiers_no = ['surgery', 'radiotherapy', 'brachytherapy', 'Newadjuvant', 'neo', 'Adjuvant', 'Mets at first diagnosis', 'M1HSPC']
keyword_identifiers_yes = ['no prior tx', 'BCR', 'Neoadjuvant', 'neo', 'Adjuvant', 'Hormone refractory', 'Mets', 'No mets']

cancer_df.insert(2, 'Result', 0, allow_duplicates = False)
#print(cancer_df.head())
for i in range(1, len(cancer_df)):

    for word in keyword_identifiers_no:
        if word in cancer_df.iloc[i]['Patient Segment(s)']:

            cancer_df.at[i,'Result'] = labels[0]
            #print(cancer_df['Patient Segment(s)'].dtype)

    for word in keyword_identifiers_yes:
        if word in cancer_df.iloc[i]['Patient Segment(s)']:
            cancer_df.at[i,'Result']= labels[0]

    cancer_df.to_csv('Result1.csv')
It seems that your 'Result' column is of type int and you are trying to set some rows to str. Stick to int or category (docs).