Icon

03 Workflow Control (FINISHED)

Workflow Control - Exercise

This workflow shows a hands-on exercise in the L2-DS Introduction to KNIME Analytics Platform for Data Scientists - Advanced course

URL: KNIME Self-Paced Courses https://www.knime.com/knime-self-paced-courses

Task 1: Generic Loop1. Read the New York City Airbnb data, and filter out rows where the room price is $02. Start a generic loop with the Generic Loop Start node3. Create a new flow variable "nights" by adding 1 to the currentIteration flow variable4. Filter the data to the rooms that are available for this number of nights (availability_365 column)5. Calculate the total prices by multiplying the nights flow variable by the price per night6. Extract the accommodations with total price $150 or less 7. Extract the number of rows as a flow variable. Use the Extract Table Dimension node.8. Collect the filtered accommodations with the Variable Condition Loop End node. Stop the loop ifthe number of rows is 0. Don't collect rows from the last iteration, but add the iteration column. Task 2: Group Loop1. Execute the Missing Value node and start a group loop where each subgroup is defined by theneighborhood and room type2. Split the data into two subsets: room price=$0 and room price>$0 3. Calculate the average price of the rooms in the latter group4. Transform the average price into a flow variable5. Replace the $0 room prices with this flow variable value. Use the Constant Value Column node.6. Concatenate the two subsets back into one table7. End the loop with a Loop End node Task 3: Switch1. Separate the provided workflow branches with an IF Switch or CASE Switch Start node2. Collect the data from the active branch with an End IF or CASE Switch End node, and connect itto the top Bar Chart node. You can delete the bottom Bar Chart node.3. Create a Single Selection Configuration node with two selection options: "room type" and"number of reviews"4. Encode the flow variable into "top"/0 if room type was selected, and into "bottom"/1 otherwise.Overwrite the active port setting of the switch node with this flow variable.5. Encapsulate the nodes into a component. Configure the component and open its interactiveview. Remove rowswith missing valuesin group columnsNode 94Node 96Node 97Node 98Node 99Node 100Node 101Node 103Node 104Node 105Node 107Node 108Node 109Node 110Node 111Node 113 Missing Value CSV Reader Row Filter Generic Loop Start Math Formula(Variable) Row Filter Math Formula Row Filter Variable ConditionLoop End paused Extract TableDimension Group Loop Start GroupBy Row Splitter Table Rowto Variable ConstantValue Column Concatenate Loop End Interactive View Task 1: Generic Loop1. Read the New York City Airbnb data, and filter out rows where the room price is $02. Start a generic loop with the Generic Loop Start node3. Create a new flow variable "nights" by adding 1 to the currentIteration flow variable4. Filter the data to the rooms that are available for this number of nights (availability_365 column)5. Calculate the total prices by multiplying the nights flow variable by the price per night6. Extract the accommodations with total price $150 or less 7. Extract the number of rows as a flow variable. Use the Extract Table Dimension node.8. Collect the filtered accommodations with the Variable Condition Loop End node. Stop the loop ifthe number of rows is 0. Don't collect rows from the last iteration, but add the iteration column. Task 2: Group Loop1. Execute the Missing Value node and start a group loop where each subgroup is defined by theneighborhood and room type2. Split the data into two subsets: room price=$0 and room price>$0 3. Calculate the average price of the rooms in the latter group4. Transform the average price into a flow variable5. Replace the $0 room prices with this flow variable value. Use the Constant Value Column node.6. Concatenate the two subsets back into one table7. End the loop with a Loop End node Task 3: Switch1. Separate the provided workflow branches with an IF Switch or CASE Switch Start node2. Collect the data from the active branch with an End IF or CASE Switch End node, and connect itto the top Bar Chart node. You can delete the bottom Bar Chart node.3. Create a Single Selection Configuration node with two selection options: "room type" and"number of reviews"4. Encode the flow variable into "top"/0 if room type was selected, and into "bottom"/1 otherwise.Overwrite the active port setting of the switch node with this flow variable.5. Encapsulate the nodes into a component. Configure the component and open its interactiveview. Remove rowswith missing valuesin group columnsNode 94Node 96Node 97Node 98Node 99Node 100Node 101Node 103Node 104Node 105Node 107Node 108Node 109Node 110Node 111Node 113 Missing Value CSV Reader Row Filter Generic Loop Start Math Formula(Variable) Row Filter Math Formula Row Filter Variable ConditionLoop End paused Extract TableDimension Group Loop Start GroupBy Row Splitter Table Rowto Variable ConstantValue Column Concatenate Loop End Interactive View

Nodes

Extensions

Links