Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if multiple pd.DataFrames are equal

Tags:

python

pandas

Is there a Pythonic way (no loops or recursion) to check if more than two pd.DataFrames (e.g., a list of pd.DataFrames) are equal to each other?

like image 355
Rations Avatar asked Aug 31 '26 15:08

Rations


1 Answers

Something like:

all(x.equals(dfs[0]) for x in dfs)

with dfs the list of dataframes. This checks if they are all equal to the first - which I think is equivalent to asking if they are all equal to one another.

like image 65
Jim Eisenberg Avatar answered Sep 02 '26 05:09

Jim Eisenberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!