pandas two columns if equal code example
Example 1: pandas two dataframes equal
>>> df = pd.DataFrame({1: [10], 2: [20]})
>>> exactly_equal = pd.DataFrame({1: [10], 2: [20]}) # Note the same as above
>>> df.equals(exactly_equal)
True
# Two are the same hence true. If not would be false
Example 2: python pandas check if two columns are equal
df = pd.DataFrame([[2, 2], [3, 6]], columns = ["col1", "col2"])