Icon

04 Numbers Strings and Rules - Solution

Solution to an exercise for data transformation.

Perform data manipulation operations with the Rule Engine, Math Formula, String Manipulation, and Column Expressions nodes.




Exercise: Numbers, Strings, and Rules1.1) Read the travel advisories data by executing the CSV Reader node below1.2) Replace the colons in the Level column by hyphen, like this: "Level 1- Exercise normalprecautions"1.3) Extract the risk levels as numbers into a separate column. You can use, for example, thesubstr() function.1.4) Complete the tasks above with the Column Expressions node2.1) Read the population data by executing the Excel Reader node below2.2) Create a new column "Change" by substracting the population values in 2018 from thepopulation values in 20192.3) Convert the absolute population change values into percentages: divide them by thepopulation values in 2018 and multiply the result by 100.2.4) Create a categorical column with two values "increasing"/"decreasing" based on whether thechange is positive or negative Extract numericrisk level into a separate columnReplace :by -Create ChangecolumnConvert change topercentageAdd Direction columnbased on +/- changeThe same tasks as abovedemographics.xlsx(population)travel_advidories.csv String Manipulation String Manipulation Math Formula Math Formula Rule Engine Column Expressions Excel Reader CSV Reader Exercise: Numbers, Strings, and Rules1.1) Read the travel advisories data by executing the CSV Reader node below1.2) Replace the colons in the Level column by hyphen, like this: "Level 1- Exercise normalprecautions"1.3) Extract the risk levels as numbers into a separate column. You can use, for example, thesubstr() function.1.4) Complete the tasks above with the Column Expressions node2.1) Read the population data by executing the Excel Reader node below2.2) Create a new column "Change" by substracting the population values in 2018 from thepopulation values in 20192.3) Convert the absolute population change values into percentages: divide them by thepopulation values in 2018 and multiply the result by 100.2.4) Create a categorical column with two values "increasing"/"decreasing" based on whether thechange is positive or negative Extract numericrisk level into a separate columnReplace :by -Create ChangecolumnConvert change topercentageAdd Direction columnbased on +/- changeThe same tasks as abovedemographics.xlsx(population)travel_advidories.csv String Manipulation String Manipulation Math Formula Math Formula Rule Engine Column Expressions Excel Reader CSV Reader

Nodes

Extensions

Links