comparing a column value in pandas code example Example: comparing two dataframe columns comparison_column = np.where(df["col1"] == df["col2"], True, False)