Skip to content

datasets (Tablesaw)

Ax Kr edited this page Feb 11, 2020 · 5 revisions

Datasets

The Dataset type is implemented with the tablesaw dataframe library

Dataset objects can be created with SemanticImport and SemanticImportString functions.

>> ds=SemanticImportString("Products,Sales,Market_Share
a,5500,3
b,12200,4
c,60000,33")

Select a single column:

>> ds(All, "Market_Share")

Select a single element:

>> ds(3, 2)

Select a row and return the result as an association

>> ds(2) // Normal 
<|Products->b,Sales->12200,Market_Share->4|>

Dataset rows can be selected.

>> ds(Select(#Sales < 13000 &), {"Products", "Market_Share"})

With the `Normal' function the Dataset can be converted into a Symja expression.

>> ds(All, "Sales") // Normal
{5500,12200,60000}

Compute number of times an element is available in the column

>> ds(Counts, "Sales")
<|60000->1,12200->1,5500->1|>

Compute the sum of a column

>> ds(Total, "Sales")
77700

Join the strings of a column

>> ds(StringJoin, "Products")
abc
		check("ds(StringJoin, \"Products\")", //
				"abc");
You can’t perform that action at this time.