How to add a default row for all the unique rows

Hi,

Can you help me with how can I add a default row for each unique row.

Thanks,
Vasudev

hi @Vasudev

you need to iterate over the “Feature 1” and assign one row per group.
Please check the workflow attached.

Z_037_Empty row per group.knwf (17.0 KB)

br
tommy

Thank Tommy for sharing the solution.

In between I had come up with the below approach to solve this during the day(Selected nodes). Your solution seems more optimal as it doesnt requires more nodes.

Regards,
Vasudev

Hi @Vasudev , what you have done is exactly how I have done it.

It’s probably the fastest and most efficient way to do this, though I can’t see what your metanode “Add Default Value columns” is doing. If it just to sort the columns, it’s not really needed. You can just invert the Concatenate input, that is put the original data at the top and the groupby at the bottom, the concatenate will automatically take the structure of the first input first. Also, it is not necessary to manually add Feature 2 following the GroupBy. Just do an aggregation that results in 0, for example count of missing value.

I put a quick demo for this:
image

Input:
image

Results:
image

Here’s the workflow: Add a default row for all the unique rows.knwf (10.4 KB)

1 Like

@bruno29a , thanks for sharing the simplified solution with very few nodes.
I was trying this option to do it by group by node and set default value for this aggregation. I wasn’t sure of this missing value count aggregation(I thought it is count missing value by group :frowning: ) .

I have another question, Is there a way to connect two nodes which are very far away in the work flow(kind of continuation node, to avoid a long connection line running over other nodes)

Thank you

Hi,

Unfortunately at this moment you have to use long connection lines. There have been discussion about creating an alias of a node that you can then use anywhere in the workflow, and I believe there is even a ticket for it. But it won’t be the highest priority as it’s a more of a nice-to-have feature.

In the meantime, you can always drag the connection lines out of the way of other nodes. The lines are “dragable” :slight_smile:

Look at this for example:
image

You can just drag the connection line like this:
image

Just click on the line, and you will see drag points

2 Likes

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