# Data transformation workflows - Wolfram U sessions

**URL:** <https://community.wolfram.com/t/data-transformation-workflows-wolfram-u-sessions/17004>\
**Category:** Ideas\
**Tags:** computer-science, data-science, mathematica, wolfram-u, external-interfaces, computational-notebooks, events-and-media\
**Created:** [November 11, 2020, 3:07pm UTC](https://community.wolfram.com/t/data-transformation-workflows-wolfram-u-sessions/17004 "2020-11-11T15:07:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![antononcube](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/antononcube/32/7348_2.png) [@antononcube](https://community.wolfram.com/u/antononcube)\
**Post date:** [November 11, 2020, 3:07pm UTC](https://community.wolfram.com/t/data-transformation-workflows-wolfram-u-sessions/17004/1 "2020-11-11T15:07:31Z")

</div>

# Data transformation workflows

## General description

The Data Transformation (DT) lectures outlined below are _to be_ recorded for  
[Wolfram U](https://www.wolfram.com/wolfram-u/)  
in October-December 2020.

- Here is the [Wolfram U recordings playlist at YouTube](https://www.youtube.com/playlist?list=PLxn-kpJHbPx0cOLcQknM1Yvpqr8w-yOkr)

- Each tutorial lecture is between 25 and 40 minutes.

- Most of the workflows in the lectures have (easy to derive) corresponding code in the programming languages: Julia, Python, R, and WL.  
(In Python and Julia dedicated data transformation packages are utilized.)

- For didactic purposes we are going to use the Domain Specific Language (DSL)  
[Raku](https://www.raku.org)-programmed  
system  
[DSL::English::DataQueryWorkflows](https://github.com/antononcube/Raku-DSL-English-DataQueryWorkflows), [AAp1],  
that generates code for the programming languages R and WL and  
the software packages:

- The WL generated code uses functions from the [Wolfram Function Repository](https://resources.wolframcloud.com/FunctionRepository/).  
(See the references section “Wolfram Function Repository functions”.)

- The tutorials sequence has an “inverted” structure: the most conceptually rich and technical sessions are presented first.

## Detailed tutorial plan

### Introduction through questions and answers

- What are the simplifying assumptions for the family of workflows considered in this tutorial?

- What are the simplifying assumptions about the targeted data and transformations?

- Do these workflows apply to other programming languages and/or data systems?

- Are additional packages needed to run the codes?

- Are there similar tutorials dedicated to other programming languages or packages?

- What are the most important concepts for a newcomer to data wrangling?

- How do the considered DT workflows relate to well known Machine Learning (ML) workflows?

- How much is WL used?

- Mental model (of the considered DT queries)

### Reshaping of data – detailed examples

- Long form (aka “narrow format”):

- Wide form (aka “wide format”)

- Cross tabulation

### Basic operations and joins

- Basic operations

- Joins

### Additional topics

- Example combinations with ML workflows
  - Making a recommender system
  - Making a classifier

## Visual aids

Here is a flow chart that encompasses a large fraction of typical tabular data transformation workflows:

 ![TabularDataTransformationWorkflow](https://global.discourse-cdn.com/wolfram/original/3X/6/b/6bf0584ec974917f7d50d0d3cc3818812d7266de.jpeg)

* * *

This call of  
[`ToDataQueryWorkflow`](https://github.com/antononcube/Raku-DSL-English-DataQueryWorkflows)  
through  
[`ExternalParsersHookUp`](https://github.com/antononcube/ConversationalAgents/blob/master/Packages/WL/ExternalParsersHookup.m), [AAp2],  
over a sequence of natural commands:

```mathematica
ToDataQueryWorkflowCode["use dfTitanic; 
      filter with passengerSurvival is 'survived';
      rename passengerClass, passengerSex as class and sex;
      cross tabulate class and sex", "Execute" -> False]

```

generates this WL code:

```mathematica
Hold[obj = dfTitanic; 
 obj = Select[obj, #1["passengerSurvival"] == "survived" &]; 
 obj = (Join[KeyDrop[#1, {"passengerClass", "passengerSex"}], Association["class" -> #1["passengerClass"], "sex" -> #1["passengerSex"]]] &) /@ obj; 
 obj = ResourceFunction["CrossTabulate"][({#1["class"], #1["sex"]} &) /@ obj]]

```

which when executed gives the dataset:

```mathematica
Dataset[<|
"1st" -> <|"female" -> 139, "male" -> 61|>, 
"2nd" -> <|"female" -> 94, "male" -> 25|>, 
"3rd" -> <|"female" -> 106, "male" -> 75|>|>, 
 TypeSystem`Assoc[TypeSystem`Atom[String], TypeSystem`Struct[{"female", "male"}, {TypeSystem`Atom[Integer], TypeSystem`Atom[Integer]}], 3], 
 <|"ID" -> 177940708079520|>]

```

## References

### Articles

[HW1] Hadley Wickham,  
[“The Split-Apply-Combine Strategy for Data Analysis”](https://www.jstatsoft.org/article/view/v040i01),  
(2011),  
Journal of Statistical Software.

[AA1] Anton Antonov,  
[“Contingency tables creation examples”](https://mathematicaforprediction.wordpress.com/2016/10/04/contingency-tables-creation-examples/),  
(2016),  
[MathematicaForPrediction at WordPress](https://mathematicaforprediction.wordpress.com).

[AA2] Anton Antonov,  
[“Pareto principle adherence examples”](https://mathematicaforprediction.wordpress.com/2016/11/17/pareto-principle-adherence-examples/),  
(2016),  
[MathematicaForPrediction at WordPress](https://mathematicaforprediction.wordpress.com).

### Packages

[AAp1] Anton Antonov,  
[DSL::English::DataQueryWorkflows Raku package](https://github.com/antononcube/Raku-DSL-English-DataQueryWorkflows),  
(2020),  
[GitHub/antononcube](https://github.com/antononcube).

[AAp2] Anton Antonov,  
[External Parsers Hookup Mathematica package](https://github.com/antononcube/ConversationalAgents/blob/master/Packages/WL/ExternalParsersHookup.m),  
(2020),  
[ConversationalAgents at GitHub](https://github.com/antononcube/ConversationalAgents).

[AAp3] Anton Antonov,  
[Cross tabulation implementation in Mathematica](https://github.com/antononcube/MathematicaForPrediction/blob/master/CrossTabulate.m),  
(2017),  
[MathematicaForPrediction at GitHub](https://github.com/antononcube/MathematicaForPrediction).

[AAp4] Anton Antonov,  
[Data reshaping Mathematica package](https://github.com/antononcube/MathematicaForPrediction/blob/master/DataReshape.m),  
(2018),  
[MathematicaForPrediction at GitHub](https://github.com/antononcube/MathematicaForPrediction).

### Wolfram Function Repository functions

Anton Antonov, [`CrossTabulate`](https://resources.wolframcloud.com/FunctionRepository/resources/CrossTabulate).

Anton Antonov, [`ExampleDataset`](https://www.wolframcloud.com/obj/antononcube/DeployedResources/Function/ExampleDataset).  
_(Submitted)_

Anton Antonov, [`ParetoPrinciplePlot`](https://resources.wolframcloud.com/FunctionRepository/resources/ParetoPrinciplePlot).

Anton Antonov, [`RecordsSummary`](https://resources.wolframcloud.com/FunctionRepository/resources/RecordsSummary).

Anton Antonov, [`ToLongForm`](https://www.wolframcloud.com/obj/antononcube/DeployedResources/Function/ToLongForm).  
_(Submitted)_

Anton Antonov, [`ToWideForm`](https://www.wolframcloud.com/obj/antononcube/DeployedResources/Function/ToWideForm).  
_(Submitted)_

Seth Chandler, [`ResetDataset`](https://resources.wolframcloud.com/FunctionRepository/resources/ResetDataset).

[Data Transformations Workflows Q\_AMP\_A Introduction.nb](https://community.wolfram.com/uploads/short-url/wzTtYCbr7G46LfnR2uJngUUe4dC.nb) (1.23 MB)
