Data360 Analyze

 View Only
  • 1.  Flattening rows

    Employee
    Posted 09-12-2023 14:17

    I am looking to "flatten" several rows into a single row preserving values in different fields.  The values will never clash (in the example below a single account would never have a colour Red in one row and Blue in another row with a need to figure out which to preserve). 

    My data looks like this:

    Account,Colour,Number,Date
    A,Red,,
    A,,7,
    A,,,12/11/72
    B,Blue,,
    B,,8,
    C,Green,,

    And the output I am looking for is:

    Account,Colour,Number,Date

    A,Red, 7,12/11/72

    B,Blue,8,

    C,Green,,

    Ideas?



    ------------------------------
    Jay Reilly
    Precisely Software Inc.
    ------------------------------


  • 2.  RE: Flattening rows

    Posted 09-13-2023 02:29

    something like this? But adapting the script in the aggregate node to exclude nulls?



    ------------------------------
    Henrik B
    E.ON Sverige
    ------------------------------



  • 3.  RE: Flattening rows

    Employee
    Posted 09-13-2023 03:16

    Thanks Henrik.  I'll give that a go. 



    ------------------------------
    Jay Reilly
    Precisely Software Inc.
    ------------------------------



  • 4.  RE: Flattening rows

    Employee
    Posted 09-13-2023 06:59
      |   view attached



    ------------------------------
    Sam Darmo
    Precisely Software Inc.
    PEARL RIVER NY
    ------------------------------

    Attachment(s)



  • 5.  RE: Flattening rows

    Posted 09-13-2023 09:41

    Nice.



    ------------------------------
    Peter Sykes
    Vontobel Holding AG
    Zurich
    ------------------------------



  • 6.  RE: Flattening rows

    Employee
    Posted 09-13-2023 10:16

    My first thought was closer to what Peter Sykes did, but with a Transform node and a Sort.  What he did is better than my first thought.

    Here is an answer that requires no Python code:



    ------------------------------
    Ernest Jones
    Precisely Software Inc.
    PEARL RIVER NY
    ------------------------------