How can I use the first row of a node output as the column header row?

#1

I know you can assign the first row of a file to be the column header row when reading in a file. But what if you have a node output in your workflow where you want to assign the first row of the output as athe column headers. Short of renaming the columns manually and filtering out the row with the column headers I'm not sure of a good way to do this. I guess I could oputput a csv file with the headers and then read it back in with the first row as the header but that seems a little roundabout just to assign the column headers. Any suggestions?

0 Likes

#2

What about: Transpose >> (Filter) >> Row ID >> Transpose, should work?

0 Likes

#3

Thanks Gabriel. It's not the most elegant way to do it but it works. I should be able to put this in a metanode so I can re-use. Would be nice though to have a node that would allow you to assign the first row as the header row (like you can for the csv file reader.

0 Likes

#4

This certainly works, but it is a slow process. It would be nice to have a Promote to Headers node.

2 Likes