How to copy dataset header to a row within the same dataset?

BetoA
edited December 2023 in General

Hello,

I want to create an additional row on my dataset which would contain a copy of the header names, E.g.

Input:

Header1,Header2,Header3,Header4 ---------------------------- Headers

1,2,3,4 ----------------------------- Data

1,2,3,4 ----------------------------- Data


Output

Header1,Header2,Header3,Header4 ---------------------------- Headers

Header1,Header2,Header3,Header4 ----------------------------- Data

1,2,3,4 ----------------------------- Data

1,2,3,4 ----------------------------- Data


Is it possible? I already tried with some workflow steps but no success.

Please, if the explanation was not clear enough let me know.

Answers

  • Pavan Rao
    Pavan Rao Experian Contributor

    Hello, One of the ways I can think of is while uploading the dataset, you can untick the option "Use first row for columns names".

    This will load the file with headers in the first row. The actual headers in that dataset will now be "Column 1" , "Column 2"....Then we can use the "Map to Target" step in the workflow to map those to the original dataset headers as Target.

    This will give us the desired output. Hope that helps...

    Regards,

    Pavan

  • Would it be possible to say data profile the data set, then take the column of column names, and pivot, then union with the dataset? I think this might require the later versions that support pivoting (unfortunately I cannot test as I'm only on 2.6).

  • Josh Boxer
    Josh Boxer Administrator
    edited August 2022

    Hi

    Can I ask why you need to do this just for my understanding?

    George - Pivot will split the data by row as well as column into a diagonal line, so you would then need to use a Group step with a separate aggregation for each column selecting the First Value. Depending on the number of columns this might be painful.

    A Custom step called 'Transpose' might help if you think this could be deployed then talk to your Experian contact