Listing all different values for an attribute

alexman
alexman New Altair Community Member
edited 2024 05 in Community Q&A
Hi,

I would like to be able to list all the different values for an attribute. For example:

City
L.A
L.A
L.A
Boston
Cleveland
New York
Rapidminer GUI output would be in range column: L.A (3) Boston(1) Cleveland(1) New york(1)
to get the number of times that L.A appears I can use Statistics.Count but I need to have the city name values isolated (L.A, Boston Cleveland, and New York)
I need to do it with rapidminer API ... is there any function like .... List l = Attribute.getDifferentValues() ?

Thx a lot
Tagged:

Answers

  • land
    land New Altair Community Member
    Hi, there's a simple method for this:

    Attribute at = null;
    List<String> values = at.getMapping().getValues();
    But keep in mind, that you will recieve every value known so far. It might be, that this value isn't contained in the actual data set you have. So some of the values might have count of 0.

    Greetings,
      Sebastian