How to group and count the elements in array simply ? #629
Unanswered
BubbleGarten
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Using groupBy can solve the problem. I think we need to add countBy builtin. We already have count. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
have :
[1,2,2,3,3,3]
want:
{"1":1,"2":2,"3":"3"}
Possible Ways:
step1: use
groupBy()
,groupBy([1,2,2,3,3,3], #)
here , got: {1:[1], 2:[2,2], 3:[3,3,3]}step2: then
map()
? but seems no way to built struct in expr-langBeta Was this translation helpful? Give feedback.
All reactions