Icon

03 Transform using Expression node (Logics and String Manipulation)

<p><strong>Transform using Expression node</strong></p><p>This workflow demonstrates the usage of the <strong>Expression</strong> node for data transformation: <strong>String manipulation</strong> and <strong>logic implementation</strong>.</p><p>The objective of the workflow is to summarize the airline dataset, analyze the delayed flights, and provide route details.</p>

URL: KNIME Self Paced Course https://www.knime.com/knime-self-paced-courses
URL: KNIME Cheat Sheet : Building a KNIME Workflow for Beginners https://www.knime.com/sites/default/files/2021-07/CheatSheet_Beginner_A3.pdf
URL: Data Manipulation: Numbers, Strings, and Rules - KNIME TV -YouTube https://www.youtube.com/watch?v=mJrBXmLQ4ko

String manipulation: Create "Route" column

Step 1:Click on the node to open the dialog box.

Step 2:In the "Expression 1" section, enter the following rule: $["Origin"] + "-" + $["Dest"]

This will concatenate the origin airport with the destination airport with a hyphen in between. Choose "Append" option and name the new column ''Route''.

Step 3: Select "Apply and Execute" to append the new column "Route" to the output table.

Implement logic: Create "Status" column

Step 1: Click on the node to open the dialog box.

Step 2: In the ""Expression 1" section and enter the following rule: if($["DepDelay"]>15,"Delayed","Not Delayed")

This will create a rule, where the flights with departure delay>15 will be given status as "Delayed" while the rest of them will be labeled as "Not Delayed". Choose Append option and name the new column as "Status".

Step 3: Select "Apply and Execute" to get the new column "Status" in the output table.

Transform using Expression node


This workflow demonstrates the usage of the Expression node for data transformation: String manipulation and logic implementation.

The objective of the workflow is to summarize the airline dataset, analyze the delayed flights, and provide route details.

Workflow complete!

Keep the momentum going by exploring Just KNIME It!on the Hub to challenge yourself and see how these nodes can be integrated into more complex workflows and use cases.

Create "Route" column:Origin-Destination
Expression
Read airline dataset:Airline.csv
CSV Reader
Count nr. of delayedflights by route
GroupBy
Sort by "Count of Flights"in descending order
Sorter
Visualizeoutput table
Table View
Create "Status" column: If departure delayed by > 15 mins,append status "Delayed"
Expression
Filter data todelayed flights
Row Filter
Rename aggregation columnto "Count of Flights"
Column Renamer

Nodes

Extensions

Links