# Is there a package to do DataFrames comparisons?

**URL:** <https://discourse.julialang.org/t/is-there-a-package-to-do-dataframes-comparisons/65713>\
**Category:** General Usage\
**Tags:** dataframes\
**Created:** [August 3, 2021, 2:08am UTC](https://discourse.julialang.org/t/is-there-a-package-to-do-dataframes-comparisons/65713 "2021-08-03T02:08:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [August 3, 2021, 2:08am UTC](https://discourse.julialang.org/t/is-there-a-package-to-do-dataframes-comparisons/65713/1 "2021-08-03T02:08:10Z")

</div>

The `a==b` works really well if `a` and `b` are the same, but it doesn’t tell me what’s different if `a` and `b` are different e.g. some column name are different.

I would if there’s a package for comparing dataFrame like `proc compare` in SAS or like pandas assert equal for data frames.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [August 3, 2021, 6:18am UTC](https://discourse.julialang.org/t/is-there-a-package-to-do-dataframes-comparisons/65713/2 "2021-08-03T06:18:35Z")

</div>

Did you set a reminder to check on this anually? 😃

> [@Is there a package to compare if two DataFrames are the same?](https://discourse.julialang.org/t/is-there-a-package-to-compare-if-two-dataframes-are-the-same/44381):
>
> Something that has more options than the == in Base for comparing dataframes? E.g. one where you can set the tolerance of difference in a float column. And also can compare columns by name even though they may be arranged in different orders? Something like proc compare in SAS.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [August 3, 2021, 11:44am UTC](https://discourse.julialang.org/t/is-there-a-package-to-do-dataframes-comparisons/65713/3 "2021-08-03T11:44:23Z")

</div>

I approximately need to do it once per year it seems.

Thought discourse would pick up the post.

I guess there isn’t exactly something I needed. So might need to create something.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [August 3, 2021, 11:52am UTC](https://discourse.julialang.org/t/is-there-a-package-to-do-dataframes-comparisons/65713/4 "2021-08-03T11:52:03Z")

</div>

Does the [response](https://stackoverflow.com/a/65914796/14071775) from Bogumił Kamiński in SO help a bit?

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [August 3, 2021, 2:18pm UTC](https://discourse.julialang.org/t/is-there-a-package-to-do-dataframes-comparisons/65713/5 "2021-08-03T14:18:43Z")

</div>

It would be really nice if @ssfrr 's [DeepDiffs.jl](https://github.com/ssfrr/DeepDiffs.jl) directly supported Tables.  
(probably displaying via PrettyTables.jl)  
But it does not

it does however support vectors

So some demos

```julia
julia> using DataFrames, DeepDiffs

julia> costs = DataFrame(brand=["BurgerDuke", "BurgerDuke", "BurgerDuke", "McDannys", "McDan
       nys"], product = ["burger", "fries", "drink", "burger", "drink"], price=[10.0, 5.0, 1.0, 9.5
       , 0.5])
5×3 DataFrame
 Row │ brand product price   
     │ String String Float64 
─────┼──────────────────────────────
   1 │ BurgerDuke burger 10.0
   2 │ BurgerDuke fries 5.0
   3 │ BurgerDuke drink 1.0
   4 │ McDannys burger 9.5
   5 │ McDan\nnys drink 0.5

julia> costs2 = DataFrame(brand=["BurgerDuke", "BurgerDuke", "BurgerDuke", "McDannys", "McDan
       nys"], product = ["burger", "fries", "drink", "burger", "drink"], price=[10.0, 7.0, 1.0, 9.5
       , 0.5])
5×3 DataFrame
 Row │ brand product price   
     │ String String Float64 
─────┼──────────────────────────────
   1 │ BurgerDuke burger 10.0
   2 │ BurgerDuke fries 7.0
   3 │ BurgerDuke drink 1.0
   4 │ McDannys burger 9.5
   5 │ McDan\nnys drink 0.5

```

by row

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/7/7725353a3d88bc25eefec1c942a8f5f8be93ac17.png)  
by column  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/d/3d18fc9cdb641d57e76568a8c6391530d5fd42c3.png)

Perhaps best is to convert to dict:  
`as_dict(t) = getfield(Tables.dictcolumntable(t), :values)`

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/6/16fd872dd6f20f4c5f9c0265968f406b15910c38.png)
