I need to count the occurrences of each element in a DolphinDB array, similar to Python’s collections.Counter. In Python, this works: from collections import Counter my_list = [1, 2, 3, 2, 1, 3, 2, 1] my_counter = Counter(my_list) print(my_counter) # Output: Counter({1: 3, 2: 3, 3: 2}) In DolphinDB, I tried using groupby with count, but it failed: myList = [1, 2, 3, 2, 1, 3, 2, 1] groupby(count, myList, myList) // Error Error: sage: groupby(func, funcArgs, groupingCol). func must be a function definition However, replacing count with avg works without errors: groupby(avg, myList, myList) // Returns (1->1, 2->2, 3->3) but not frequency Why does groupby fail with count but work with avg? Any solutions? Continue reading...