Icon

Exercise1

<p><strong>Chapter 2/Exercise 1</strong></p><p>This exercise shows how to read a <em>.txt</em> file using the CSV Reader node. The <em>data1.txt</em> file has a header with comments which we don't want to read. The workflow is showing two methods on how to apply advanced file reading features to exclude the comment header from the data:</p><ol><li><p>CSV Reader with "Support short data rows" enabled and "Skip first 5 data rows" in "Limit Rows" tab</p></li><li><p>CSV Reader with only "Support short data rows" enabled and subsequent Row Filter to remove first 5 spurious rows</p></li></ol><p>It then apply a Column Filter to clean the data and writes it to a <em>.csv</em> file.<br><br></p>

URL: KNIME Beginner's Luck (Book Homepage) https://www.knime.com/knimepress/beginners-luck

Workflow: Chapter 2/Exercise 1


This exercise shows how to read a .txt file using the CSV Reader node. The data1.txt file has a header with comments which we don't want to read. The workflow is showing two methods on how to apply advanced file reading features to exclude the comment header from the data:

  1. CSV Reader with "Support short data rows" enabled and "Skip first 5 data rows" in "Limit Rows" tab

  2. CSV Reader with only "Support short data rows" enabled and subsequent Row Filter to remove first 5 spurious rows

It then apply a Column Filter to clean the data and writes it to a .csv file.

Reading data

Cleaning data

Writing data

data1.txt "support short rows" enabled skip first 5 rows rename "ranking" into "marks"
CSV Reader
data1.txtonly "support short rows" enabledrename "ranking" into "marks"
CSV Reader
Exclude column <class>
Column Filter
Write to new filewith column headers
CSV Writer
Exclude column<class>
Column Filter
Write to new filewith column headers
CSV Writer
Exclude first 5 rows
Row Filter

Nodes

Extensions

Links