How do I compare two polars DataFrames for value equality? It appears that == is only true if the two tables are the same object:
import polars as pl
pl.DataFrame({"x": [1,2,3]}) == pl.DataFrame({"x": [1,2,3]}) # False
In addition to the correct answer above, it is good to note that for unit testing there is polars.testing.assert_frame_equal, which provides better error reporting, has more configuration options and raises an assertion on False.
As of polars 0.19.16, frame_equals was deprecated in favour of pl.DataFrame.equals.
import polars as pl
pl.DataFrame({"x": [1,2,3]}).equals(pl.DataFrame({"x": [1,2,3]})) # True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With