Hey data friends, today we’re going to walk through how to rename your columns in Knime. Let’s get started!
The data table we will be working with today is the one pictured below:
This is the same data table we worked with when we walked through how to calculate product mix (or market share) in one of our older videos. Our goal today will be to rename the “Weekly Pay” & “Weekly Pay(Yearly)” columns so that they’re a bit more descriptive of the work we were using them for. We will rename the columns per the below:
• “Weekly Pay” to “Department Labor Expense”
• “Weekly Pay(Yearly)” to “Total Labor Expense (Yr)”
The node that we need to rename columns in Knime is the Column Rename node. You can find this node by typing “Column Rename” into the node repository window, just like in the below screenshot.
Drag & Drop the Column Rename node onto your workflow and connect it to your current data. Double click into the node and you’ll see the following Configuration Menu
The Configuration menu has all the available columns in the window to the right, while there is a blank/grey window to the left. If you double-click a column name, the column will be moved over to the blank/grey space. Once double-clicked and moved into the grey window, the column can be renamed. That’s how easy Knime makes it to rename the columns in our data table. Below are the two columns that we’ve selected to rename.
Now that the columns are in the grey window, we can either check the “Change” box (red arrow) and then rename the column, or we can click on the greyed-out Column name (blue arrow) and then rename the column. Either of these options works, it’s just a matter of preference here.
A side-note, the Rename Node gives us the flexibility to change the data type of the column we’re renaming as well. Simply click on the list (to the right of the rename input box) that shows the current data type and select the new data type you’d like to convert the column to.
Below is how our fully configured menu looks:
Now that we’ve got our node configured we can click Apply, Ok, and Execute the node.
Our Final Output looks like the below:
We’ve successfully renamed the columns in our data table using the Knime Analytics Platform!
This how-to is an intro to the column rename in Knime, however, there is additional flexibility to rename columns dynamically. I’ll put together a how-to on that in the future and link it here once it’s done.
If you have any questions or comments, don’t hesitate to DM me on Twitter! My username is @Cest_Nick! Otherwise, I’ll catch you on the next post!