title: Group same values inside array
body: <p>I have an array with identical values inside it. I want to create an array inside the array containing the name as well as the number of times it had occur in the array. Here's an example of the input and output:</p>
  <p>Input:</p>
  <pre><code>['apple', 'apple', 'apple', 'pear', 'pear', 'orange', 'apple', 'orange']
  </code></pre>
  <p>will output:</p>
  <pre><code>[{'name': 'apple', 'number': 4}, {'name': 'orange', 'number': 2}, {'name': 'pear', 'number': 2}]
  </code></pre>