Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Force a reanalysis of the types contained in a Dataset, sometimes leading to a different presentation of the data
ResetDataset conducts useful type deduction and provides attractive column headers for the data after type inference in determining the yth part of the original Dataset fails to capture all the regularities:
In[1]:= |
Out[1]= |
Here the passengers on the Titanic are grouped according to sex and cabin class and then counted, but the original grouping fails to realize that the data is better presented in a “spread” format with row headers and column headers, rather than in a narrow way:
In[2]:= |
In[3]:= |
Out[3]= |
One can see that the internal representation of the data can change after ResetDataset, here being transformed from a struct in which the values are associations to an Association in which the values are structs:
In[4]:= |
Out[4]= |
Often ResetDataset does nothing, though it would not seem to do any harm:
In[5]:= |
Out[5]= |
There are limits to what ResetDataset can do. It does not, for example, sort the keys in a way that would produce a more attractive presentation:
In[6]:= |
Out[6]= |
There are methods other than ResetDataset for transforming the presentation of a Dataset, such as sorting the keys:
In[7]:= |
Out[7]= |
This work is licensed under a Creative Commons Attribution 4.0 International License