Why am I getting the following error message: Unsupported operand type(s) for +: ‘int’ and ‘str’. See below the python rules body

find out what are the types of variables which you are trying to use + on by using:
type(x)
where x is your variable name. int(x) might solve the issue.
Also, this might happen if you
1. have some characters in the column in the file where you expect only numbers, solution is to clean the file
2. you have null values which were not recognized during import of file. If you are using pandas read_csv you might need to set na_values parameter.

Leave a Comment