🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Differentiating data per attribute

User: "bernardo_pagnon"
New Altair Community Member
Updated by Jocelyn
Hello all,

I have the following data 
  att1 att2   att3
1 8     9       9
2 9     10      8

So, attribute 1 can assume values 8 or 9, attribute 2 values 9 and 10, and attribute 3 values  8 and 9. Thing is, all those nines do not represent the same thing. How can I change those values in order to avoid conflict?
If I change all the nines at the same time it does not help me. In a way, I have "9 of attribute 1", "9 of attribute 2" and "9 of attribute 3". Same thing with 8 for attributes 1 and 3. How can map them (I tried the map operator and could not do it) into different numbers/representations to avoid confusion?

Regards,
Bernardo

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "varunm1"
    New Altair Community Member
    Accepted Answer
    Hello @bernardo_pagnon

    You can use the "loop attribute" operator and inside that keep the "map" operator. In the below example, I used "Titanic Training" Dataset.l In this, my focus is to change value "0" present in two attributes "Number of siblings or spouses on board" and "Number of parents or children on board". I tried to replace value "0" in  "Number of siblings or spouses on board" with "1" and "Number of parents or children on board" with 2

    For this, I selected these two attributes in the loop attributes operator by selecting a subset in "attribute filter type" and then selecting the required two attributes in the attributes option. I also need to remember the macro name "loop_attribute" to be used in "map" operator. You also need to check the reuse results, that will run the loop once on first attribute and use the results of that to modify the second attribute.



    Now inside the "loop_attributes", I will set a map operator. As I need to replace the value of "0" in each attribute one by one, I will extract that attribute name based on "attribute filter type" single and then adding macro name %{loop_attribue} in attribute parameter of map operator. Then, I will replace the value "0" with 1 and 2 for different attributes. This is by using %{execution_count} macro that uses the execution count of loop attribute operator as a value (1 for the first iteration and 2 for second iteration). 



    Hope this helps. Do let us know if you need more information