compare two columns in a condition pandas dataframe code example
Example 1: comparing two dataframe columns
comparison_column = np.where(df["col1"] == df["col2"], True, False)
Example 2: python pandas check if two columns are equal
df = pd.DataFrame([[2, 2], [3, 6]], columns = ["col1", "col2"])