I don's sure this is a bug or not.Suppose I have a dataset

dataset = 
 Dataset[{{"a", 10}, {"b", 11}, {"c", 12}, {"d", 5}, {"e", 99}}]

Then we do two same operation on it.

{set1 = dataset[All, <|"col1" -> 1, "col2" -> 2|>], 
 set2 = dataset[Map[AssociationThread[{"col1", "col2"} -> #] &]]}

As we see,we get two data set totally.But in some time,we can not judge it just by our eyes.Let use == or === to test it.

set1 == set2

set1 === set2


Of course Equal @@ Normal /@ {set1, set2} works well,but the Normal don't judge two Dataset instead of two List actually.So I have two question here:

  1. Why the == and === will fail here?
  2. Is there any method can judge two datasets are same or not?
  • 1
    $\begingroup$ For part 1 compare FullForm@set1 and FullForm@set2. You seem to have answered part 2 yourself. $\endgroup$
    – Edmund
    Jul 8, 2017 at 3:57
  • 1
    $\begingroup$ It's enough to make you hate metadata. Datasets are becoming a language unto itself. $\endgroup$
    – Michael E2
    Aug 14, 2017 at 22:20

1 Answer 1


The difference is in the "ID" part of the FullForm of the datasets, not in the data. So, if you want to compare the data portion, you can use the function:

compareDatasets[s1_Dataset, s2_Dataset] := 
  SameQ @@ (Cases[# // FullForm, HoldPattern@Dataset[a_, ___] :> a] & /@ {s1, s2})

We can test it on the datasets provided in the OP:

compareDatasets[set1, set2]


compareDatasets[set1, dataset[Map[AssociationThread[{"col1", "col3"} -> #] &]]]


  • 2
    $\begingroup$ Yes, the IDs are different (in a system´s point of view), but from a users point of view, the Datasets are equal, so maybe a Query like "DatasetEqualQ" may be useful to increase the usability of Datasets. Maybe we see this in an upcoming version $\endgroup$
    – mgamer
    Jul 15, 2017 at 20:28
  • 1
    $\begingroup$ This jumps through a lot of hoops where Equal @@ Normal /@ {set1, set2} is sufficient and included in the OP. $\endgroup$
    – Edmund
    Aug 14, 2017 at 22:00
  • 1
    $\begingroup$ I just think the Equal should be True。But the Same give False $\endgroup$
    – yode
    Aug 15, 2017 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.