Search code examples
pythonpandascompare

Python comparing 2 columns


I have a doubt and i tried with this code.

Im addin a new column to compare two columns so if they are equal return True and if they arent retunr False.

i Upload a pic of the codeenter image description here


Solution

  • Try using the equal-to operator (==) instead. For example:

    Evo_FlagF3['new_column'] = Evo_FlagF3['0.0'] == Evo_FlagF3['sum']