The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

How to index and find common elements in the list ?

HarshavHarshav Member Posts: 33 Learner II
I found that if a cell in an attribute has list of elements .We can index only one element using [] .But what if we want to index all the elements like [0:] in python. 
Finally, I want to find out common elements of two attributes in which all rows contain list data .

Answers

  • ceaperezceaperez Member Posts: 541 Unicorn
    Hi @Harshav

    please check the Select operator:
    Select - RapidMiner Documentation

    Also you can work with Python using  the Execute Python operator. 
    please find attached a example process for that.

    Best
  • HarshavHarshav Member Posts: 33 Learner II
    There is no code policy in my project and I see I cant loop list like data of each cell something like this  [1,2,3,45,6] 
  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    Hi @Harshav,

    there is a Split operator that you can use to split up the contents of an attribute on the specified separator character.

    Usually you would then use De-Pivot to convert the newly created columns (attribute_1, attribute_2 etc.) to rows and process them with Aggregate (to get the most frequent values etc.).

    Regards,
    Balázs
  • MartinLiebigMartinLiebig Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533 RM Data Scientist
    Hi Harshav,

    I am a bit confused here. Also pd.Dataframe does not allow a list in a cell. So the python equavalent does not really hold here. As mentioned, the split operator is of course the usual way to go here.

    Best,
    Martin
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • HarshavHarshav Member Posts: 33 Learner II
    Split operator gives you the result in that form ,but here I have compare two split values that are in this form["..."]
  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    I don't understand your question.
    Can you write examples of the data you have to process?

    Are the brackets there before the split? 
    [val1,val2,val3]
    Then use Replace to remove the brackets with a regular expression.

    Regards,
    Balázs
  • HarshavHarshav Member Posts: 33 Learner II
    Okay...If we remove[] using reg exp , How do we compare val1,val2,val3 with another attribute which contains val2,val4,val5.?I want this val2 element to pop up.
  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    If you de-pivot the data, your val1, val2, ... val5 will be simple values in rows. You can then use Join on a key field and the value to get the common elements.
Sign In or Register to comment.