Column Aggregator - "2nd to last" Aggregation method?

I’m using the great “Last”-Aggregation method in the “Column Aggregator” a lot.
But now I would need just the same not for the last, but the second to last column.
Is this somehow possible? Or does a workaround with another node exist?

Hi there!

Not with Column Aggregator node but there are couple of workaround methods depending on your use case. You can use Column Resorter node to move columnof interest to the last place and use same Last aggregation method in Column Aggregator node. Also you can filter out last column, use same method and then join back originally column you filtered.

Br,
Ivan

1 Like

Hi Ivan,

thanks for the answer. I thought about this, too. But there is a problem, because not all columns are always filled. So, the 2nd to last column cloud be always another column.

It looks like this

A B C ?
A B ? ?
A B C D

And I would like to have a new column with this values

B
A
C

But, if I put the 2nd to last column to the end or filter out the last column, it would look like this

C
?
C

Hi there!

I see it now. Now it makes sense using Last :slight_smile:

Use Column Aggregator with List method. After that use Column Expressions node to get the penultimate element.

Syntax is following:
column("List")[arrayLength(column("List"))-2].

Hope this is a real workaround :smiley:

Br,
Ivan

4 Likes

Works perfectly! Thanks a lot!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.