Function Repository Resource:

DatasetForm

Source Notebook

Display data formatted like a dataset

Contributed by: Bob Sandheinrich

ResourceFunction["DatasetForm"][data]

gives data formatted like a Dataset, but still interpreted as data.

Details and Options

ResourceFunction["DatasetForm"] only changes the formatting of the output. It does not change the computable nature of the data or optimize it for queries like Dataset.
Unlike Dataset, the output of ResourceFunction["DatasetForm"] can be copied and reused.
ResourceFunction["DatasetForm"] accepts any data structure supported by Dataset, including a Dataset.

Examples

Basic Examples (2) 

Output rows of data as a dataset:

In[1]:=
ResourceFunction["DatasetForm"][
 Table[<|"x" -> RandomInteger[1000], "y" -> RandomReal[]|>, {3}]]
Out[1]=

Copying the result and reevaluating gives the original data:

In[2]:=
{<|"x" -> 773, "y" -> 0.9758129606815749|>, <|"x" -> 767, "y" -> 0.7936232581210563|>, <|"x" -> 884, "y" -> 0.2519684558814408|>}
Out[2]=

Scope (3) 

A row of values:

In[3]:=
ResourceFunction["DatasetForm"][Range[15]]
Out[3]=

Labeled rows and columns:

In[4]:=
ResourceFunction["DatasetForm"][
 EntityValue[
  EntityClass["Element", "NobleGas"], {"BoilingPoint", "Density"}, "Dataset"]]
Out[4]=

A larger dataset creates a larger output with scroll bars:

In[5]:=
ResourceFunction["DatasetForm"][
 ResourceData["IBRD Statement of Loans"]]
Out[5]=

Properties and Relations (3) 

Dataset gives a result that can not be copied:

In[6]:=
dataset = Dataset[{<|"a" -> 1, "b" -> "x", "c" -> {1}|>}]
Out[6]=
In[7]:=
Dataset[ <> ]

Use DatasetForm on the dataset to make it copyable:

In[8]:=
ResourceFunction["DatasetForm"][dataset]
Out[8]=
In[9]:=
Removed["Dataset"][{<|"a" -> 1, "b" -> "x", "c" -> {1}|>}, 
TypeSystem`Vector[
TypeSystem`Struct[{"a", "b", "c"}, {
TypeSystem`Atom[Integer], 
TypeSystem`Atom[String], 
TypeSystem`Vector[
TypeSystem`Atom[Integer], 1]}], 1], <|"ID" -> 103354260748847|>]
Out[9]=

The output of DatasetForm is not computable like a Dataset:

In[10]:=
ResourceFunction["DatasetForm"][
  Table[<|"x" -> RandomInteger[1000], "y" -> RandomReal[]|>, {10}]][
 Select[#x < 100 &]]
Out[10]=
In[11]:=
Dataset[Table[<|"x" -> RandomInteger[1000], "y" -> RandomReal[]|>, {10}]][Select[#x < 100 &]]
Out[11]=

The result of DatasetForm is a DatasetForm object:

In[12]:=
Head[ResourceFunction["DatasetForm"][Range[100]]]
Out[12]=

Version History

  • 1.0.0 – 17 May 2019

Related Resources

License Information