"Group by Attributes" Parameter in "Aggregate" Operator is leading to some sorting problems

ella_
ella_ New Altair Community Member
edited November 2024 in Community Q&A
Hi everybody,

I was discretizing an Attribute "id_copy" so that the Attribute time has a sample rate of 1 second now.
Afterwards I used the "Aggregate" Operator for Averaging all Attributes except "id_copy" and grouping them by "id_copy".
This worked well for samling down and averaging the data but it lead to some sorting problems.
"id_copy" is sorted like 109, 11, 110, 111, 112 e.g.

The problem seems to be, that there should be some zeros as placeholders in "id_copy" and in "id" so they can be sorted like 009, 010, 011 e.g.
The "Sort" Operator for the Attribute "id_copy" in increasing direction didn´t change anything.

Can anybody help me with this issue?

Best
Ella
Tagged:

Best Answer

  • kayman
    kayman New Altair Community Member
    Answer ✓
    Most likely your id treated as a nominal and not as an integer, which is probably even intended as otherwise you wouldn't be able to use 009 and so. If you need to keep this trailing zeros you could create a copy of the id column, parse this as a number and apply the sort on this attribute. This will give proper numeric sorting. 

    The sorting you have now is perfectly normal from 'nominal point of view'.

Answers

  • kayman
    kayman New Altair Community Member
    Answer ✓
    Most likely your id treated as a nominal and not as an integer, which is probably even intended as otherwise you wouldn't be able to use 009 and so. If you need to keep this trailing zeros you could create a copy of the id column, parse this as a number and apply the sort on this attribute. This will give proper numeric sorting. 

    The sorting you have now is perfectly normal from 'nominal point of view'.
  • ella_
    ella_ New Altair Community Member
    @kayman thanks for your response, problem is solved.

    Yes, changing data type was a good note.
    I copied the id column and used the "Nominal to Numerical" Operator for generating unique integers as id. Sorting works well now.
    Best
    Ella