How to construct a dataset with lists as columns

Let's take some example lists:

lis1 = {1, 2, 3, 4, 5};
lis2 = {6, 7, 8, 9, 0};
lis3 = {2, 4, 6, 8, 9};

Now you can combine your lists into one list and your headers into a different list:

data = {lis1, lis2, lis3};
header = {"a", "b", "c"};

To create a dataset just do:

Dataset@Map[AssociationThread[header, #] &]@Transpose[data]

Mathematica graphics


If using Mathematica version 10.1 or later, we can write:

lista = {1, 2, 3, 4, 5};
listb = {6, 7, 8, 9, 0};
listc = {2, 4, 6, 8, 9};

<| "a" -> lista, "b" -> listb, "c" -> listc |> // Query[Transpose] // Dataset

Dataset screenshot

We can also write:

<| "a" -> lista, "b" -> listb, "c" -> listc |> // Dataset // Transpose

... but version 10.4 introduced a regression where the resulting dataset loses its type information (the expression works fine in versions 10.1, 10.2 and 10.3).