Can anyone show me how I can calculate the number of unique values within the list of each record using Python?
For example, what is the count of "Primary" or "Repair"?
I know that I can do this easily by exploding the list and go from there. But since I have over 1mil lists, I think the best way to do it is to take advantage of Python to improve performance. Thanks in advance!
Have you looked at the ListHistogrammer? Would that get you what you need?
I will take a look at that transformer.
But this solved my problem:
import fme
from collections import Counter
import fmeobjects
my_list = feature.getAttribute('Business_Points_List{}.ODP Category')
for x in range(0,20):
print Counter(my_list).keys())x]
print Counter(my_list).values())x]
feature.setAttribute(Counter(my_list).keys())x], Counter(my_list).values())x])
Scanning file for viruses.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
This file cannot be downloaded
Sorry, our virus scanner detected that this file isn't safe to download.