Reduces a sequence of items by counting each unique item >>> seq(['a', 'a', 'a', 'b', 'b', 'c', 'd']).count_by_value() [('a', 3), ('b', 2), ('c', 1), ('d', 1)] :return: Sequence of tuples where value is the count of each key
(self)
| 916 | return self._transform(transformations.count_by_key_t()) |
| 917 | |
| 918 | def count_by_value(self): |
| 919 | """ |
| 920 | Reduces a sequence of items by counting each unique item |
| 921 | |
| 922 | >>> seq(['a', 'a', 'a', 'b', 'b', 'c', 'd']).count_by_value() |
| 923 | [('a', 3), ('b', 2), ('c', 1), ('d', 1)] |
| 924 | :return: Sequence of tuples where value is the count of each key |
| 925 | """ |
| 926 | return self._transform(transformations.count_by_value_t()) |
| 927 | |
| 928 | def reduce(self, func, *initial): |
| 929 | """ |