I want to create a new list (c2) out of intersection of Buy1 with an Item346 Buy1 : [Item 12, Item 23, Item 7, Item 562, Item 346, Item 85]
List I want to return (vsm representation) c2 : [0, 0, 0, 0, 1, 0]
I want to create a new list (c2) out of intersection of Buy1 with an Item346 Buy1 : [Item 12, Item 23, Item 7, Item 562, Item 346, Item 85]
List I want to return (vsm representation) c2 : [0, 0, 0, 0, 1, 0]
Copyright © 2021 Jogjafile Inc.
If you really want 0's for when the values aren't equal, and 1's for when they are, you can use a list extraction using CASE to handle the output:
EDIT: If your input is a list of items, and not just a single item, then we can use a list membership check (using
IN
) to decide when to output 1 or 0: