Icon

05 Transform using Pivot node

<p><strong>Transform Data: Pivot</strong></p><p>Create a <strong>Pivot table</strong> with one or more <em>group columns</em> and one or more <em>pivot columns</em>. Apply <strong>basic aggregation</strong> methods like sum and count, <strong>statistical aggregation</strong> methods, and <strong>aggregation methods</strong> available for columns <strong>of type <em>Date&amp;Time</em></strong>. Apply multiple aggregation methods to one or more aggregation columns.</p>

URL: KNIME Learning Center https://www.knime.com/learning
URL: KNIME Cheat Sheet: Building a KNIME workflow for beginners https://www.knime.com/cheat-sheets/building-knime-workflow-beginners
URL: KNIME Cheat Sheet: Data wrangling with KNIME Analytics Platform https://www.knime.com/files/data-wrangling-with-knime.pdf
URL: YouTube: Data Aggregation with KNIME: Pivoting https://youtu.be/CztrVMdjuug?si=5LZcqhew6hV-yeDV

Basic Pivot table example:
One group column and one pivot column

Question: How many male/female customers belong to each age bin?

  • Group: Age Bin

  • Pivot: Gender

  • Aggregation Column: CustomerKey (or any other)

  • Aggregation Operator: Count

Two group columns and one pivot column

Question: Which web activity classes are represented in groups according to marital status, gender and sentiment?

  • Group: MaritalStatus, Gender

  • Pivot: Sentiment Analysis

  • Aggregation Column: WebActivity

  • Aggregation Operator: Unique concatenate

Aggregation of Date&Time column

Question: What is the age dispersion of the customers according to different product and sentiment groups?

  • Group: Product

  • Pivot: Sentiment analysis

  • Aggregation Column: birthday

  • Aggregation Operator: Date range(day)

Two aggregation operators

Question: What is the mean and standard deviation of income according to different sentiment and gender groups?

  • Group: Sentiment Analysis

  • Pivot: Gender

  • Aggregation Column: EstimatedYearlyIncome

  • Aggregation Operator: Mean, Standard deviation

Transform Data: Pivot


Create a Pivot table with one or more group columns and one or more pivot columns. Apply basic aggregation methods like sum and count, statistical aggregation methods, and aggregation methods available for columns of type Date&Time. Apply multiple aggregation methods to one or more aggregation columns.

One group column and two pivot columns

Question: What is the most common product among customers according to their sentiment, gender and marital status?

  • Group: Sentiment Analysis

  • Pivot: MaritalStatus, Gender

  • Aggregation Column: Product

  • Aggregation Operator: Mode

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.

Count of customers
Pivot
Mean and standard deviation of income
Pivot
Read democustomer data
Table Reader
Date range(day) of birthdays
Pivot
Read democustomer data
Table Reader
Unique concatenate of web activity classes
Pivot
Customer data
Table Reader
Mode of product
Pivot
Read democustomer data
Table Reader
Read democustomer data
Table Reader

Nodes

Extensions

Links