EXAMPLE - Rename columns with rows
This example illustrates how you can rename columns based on the contents of specified rows.
Source:
You have imported the following racer data on heat times from a CSV file. When loaded in the Transformer page, it looks like the following:
(rowId) | column2 | column3 | column4 | column5 |
---|---|---|---|---|
1 | Racer | Heat 1 | Heat 2 | Heat 3 |
2 | Racer X | 37.22 | 38.22 | 37.61 |
3 | Racer Y | 41.33 | DQ | 38.04 |
4 | Racer Z | 39.27 | 39.04 | 38.85 |
In the above, the (rowId)
column references the row numbers displayed in the data grid; it is not part of the dataset. This information is available when you hover over the black dot on the left side of the screen.
Transformation:
You have examined the best performance in each heat according to the sample. You then notice that the data contains headers, but you forget how it was originally sorted. The data now looks like the following:
(rowId) | column2 | column3 | column4 | column5 |
---|---|---|---|---|
1 | Racer Y | 41.33 | DQ | 38.04 |
2 | Racer | Heat 1 | Heat 2 | Heat 3 |
3 | Racer X | 37.22 | 38.22 | 37.61 |
4 | Racer Z | 39.27 | 39.04 | 38.85 |
You can use the following transformation to use the third row as your header for each column:
Transformation Name |
|
---|---|
Parameter: Option | Use row(s) as column names |
Parameter: Type | Use a single row to name columns |
Parameter: Row number | 3 |
Results:
After you have applied the above transformation, your data should look like the following:
(rowId) | Racer | Heat_1 | Heat_2 | Heat_3 |
---|---|---|---|---|
3 | Racer Y | 41.33 | DQ | 38.04 |
2 | Racer X | 37.22 | 38.22 | 37.61 |
4 | Racer Z | 39.27 | 39.04 | 38.85 |