In the csv files, boolean values can appear as TRUE/FALSE, which look like strings, but they are actually evaluated as boolean values when you read csv with pandas. I came up with this yesterday when I was trying to do this: df.replace({ 'TRUE': 1, 'FALSE': 0}) but it didn't work. The fix was df.replace({ True: 1, False: 0})