Skip to content
masterclass Buddy

Pandas · Method

df.compare

Compares two identically labeled DataFrames cell by cell and returns their differences. You can control whether equal values and unchanged rows or columns appear.

Last updated

Syntax

DataFrame.compare(other, align_axis=1, keep_shape=False, keep_equal=False, result_names=('self', 'other'))

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • Series.compare
  • DataFrame.equals

Source: pandas.DataFrame.compare — pandas 3.1.0 documentation. Checked 2026-11-03.