1

I would consider myself transitioning from beginner to intermediate skill in Mathematica, and am finally exploring Associations and Datasets. I am using version 12.

I have a Dataset (list of associations) I would like to Append another list of associations to this Dataset like so:

    dataset1 = Dataset[{<|a -> 11, b -> 12, c -> 13|>,<|a -> 21, b -> 22, c -> 22|> }]
    listAssocs = {<|m -> 31, n -> 32, p -> 33|>,<|m -> 41, n -> 42, p -> 43|>}

idealDataset=Dataset[{<|a -> 11, b -> 12, c -> 13,m -> 31, n -> 32, p -> 33|>,<|a -> 21, b -> 22, c -> 22,m -> 41, n -> 42, p -> 43|> }]

I have tried the following from the documentation and other answers:

dataset1[All, # ~Join~ listAssocs &]  (*obviously this would map the entire List of listAssocs to each row, but I tried*)

Map[dataset1[All, # ~Join~ #2 &],listAssocs] (*somehow simultaneously map each row of dataset1 to # and listAssocs to #2 and then join them??? *)

MapThread[Join,{dataset1,listAssocs}]

So far I have had to workaroud via unpacking like so:

MapThread[Join, {dataset1// Normal, listAssocs}]

0 Answers0