Questions tagged [dataset]

Questions on the Dataset data type and related functionality introduced in version 10. Do not use for questions on data in more generic list format or data-manipulation questions generally.

Relevant documentation pages:

Example questions:

783 questions
19
votes
3 answers

Applying different functions to different columns of a Dataset

Suppose I have different functions: Total, Mean and Max and the following Dataset SeedRandom[0] dataSet = Dataset[AssociationThread[{"a", "b", "c", "d"} -> #] & /@ RandomReal[4, {10, 4}]] How can I do the following: apply Total to column "b", Mean…
smayhem
  • 325
  • 1
  • 8
19
votes
3 answers

Change dataset key name

Using the example in the documentation, how would I make a new dataset with the key "b" changed to key "h". dataset = Dataset[{ <|"a" -> 1, "b" -> "x", "c" -> {1}|>, <|"a" -> 2, "b" -> "y", "c" -> {2, 3}|>, <|"a" -> 3, "b" -> "z", "c" ->…
Mitchell Kaplan
  • 3,696
  • 22
  • 34
18
votes
5 answers

GroupBy several keys while keeping the Dataset as a Table (List of Associations)

Assume you import data from a Table source of the following format. << GeneralUtilities`; fields = {"Country", "Region", "BU", "Year", "Date", "Sales"}; organization = {{"Argentina", "LATAM", "Americas"}, {"SouthAfrica", "Africa", "EAME"},…
Zviovich
  • 9,308
  • 1
  • 30
  • 52
16
votes
1 answer

Dataset with more than 16 "columns"?

A Dataset with 16 columns or less is shown in a nice way: Association @@@ Table["col" <> ToString@j -> i j, {i, 10}, {j, 16}] // Dataset A Dataset with more than 16 columns no. set = Association @@@ Table["col" <> ToString@j -> i j, {i,…
unlikely
  • 7,103
  • 20
  • 52
16
votes
2 answers

How to work with a Dataset?

I have an application for which a Dataset appears useful. I want a structured dataset which consists of a set of records, which are presumably Associations. For the data set, I would like to be able to perform the following operations: Add a…
David Keith
  • 4,340
  • 1
  • 12
  • 28
15
votes
3 answers

How to get control of Dataset display?

According to the documentation But If I run Dataset@<|101 -> <|t -> 42, r -> 7.5`|>, 102 -> <|t -> 42, r -> 7.5`|>, 103 -> <|t -> 42, r -> 7.5`|>|> I got Which is not right. Only if I turn t to "t" and r to "r" to run Dataset@<|101 -> <|"t"…
matheorem
  • 17,132
  • 8
  • 45
  • 115
13
votes
2 answers

Add column heads to a dataset

I have a dataset which I group an then calculate the maximum of an item. When done I get the desired result, but have no column heads. Here the example association (subset of my data): tn = {<|"year" -> "2004", "month" -> "01", "different" ->…
mgamer
  • 5,593
  • 18
  • 26
13
votes
5 answers

Dataset Processing: efficient ways to clean and merge sets for Life Sciences

Dataset Processing (for Life Sciences) Note: a related, but distinct task is posted here ID Swapping: Efficient use of a reference table to convert ID values. A common task, at least for me, involves analyzing at least two different Datasets. A…
SumNeuron
  • 5,422
  • 19
  • 51
13
votes
3 answers

Create a new dataset column based on the row key

I am wondering if there is a straightforward way to add a new column to a dataset if the column needs to be computed from the key values rather than other columns. Here is a simple example. dataset=<|101-><|"Column1"->"a"|>, …
Andrei
  • 351
  • 1
  • 8
12
votes
4 answers

Dataset: get number of levels and elements

The summary box for Dataset objects shows the number of levels and elements at the bottom. How can we get these values programmatically? For example, "4 levels, 350 elements" in the Planets dataset:
Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
11
votes
5 answers

Select only first n elements in operator form?

Is there any way to make Select take a second argument (to select only the first n elems) while in operator form? It's too slow to perform the whole selection and then take the first n, for example: dataset = Dataset[Table[<|"a" ->…
M.R.
  • 31,425
  • 8
  • 90
  • 281
10
votes
4 answers

Converting datasets to nested lists

Imagine the Shipments relation: SP = Dataset[{ <|"SNO" -> "S1", "PNO" -> "P1", "QTY" -> 300|>, <|"SNO" -> "S1", "PNO" -> "P2", "QTY" -> 200|>, <|"SNO" -> "S1", "PNO" -> "P3", "QTY" -> 400|>, <|"SNO" -> "S1", "PNO" -> "P4", "QTY" -> 200|>, <|"SNO" ->…
Eric Brown
  • 4,406
  • 1
  • 18
  • 36
10
votes
4 answers

Display information as fractions in dataset

I have some data that I want to display as rationals. someData={<|"utilization fraction" -> 1, "power fraction" -> 1|>, <|"utilization fraction" -> 7/8, "power fraction" -> 224/225|>, <|"utilization fraction" -> 3/4, "power fraction" -> 48/49|>,…
Mark R
  • 1,589
  • 5
  • 10
10
votes
2 answers

Dataset from association of lists doesn't work

Mathematica 12 on wolfram cloud isn't rendering the table for an association of lists. According to the documentation you should be able to make columns in the table by: However I tried this $Version thing2 = Dataset[<|"apple"…
ions me
  • 881
  • 5
  • 11
10
votes
1 answer

Dataset Association of Association vs Hierarchical data

I have the following dataset: Dataset[ <|1 -> <|"High School" -> 96, "Graduate" -> 138, "Uneducated" -> 58, "College" -> 53, "Unknown" -> 75, "Post-Graduate" -> 41, "Doctorate" -> 1|>, 2 -> <|"Uneducated" -> 185, "Graduate" -> 382, "College" ->…
Whelp
  • 1,715
  • 10
  • 21
1
2 3
9 10