title: Assign unique id to list of lists in python where duplicates get the same id
body: <p>I have a list of lists (which can contain up to 90k elements)</p>
  
  <pre><code>[[1,2,3], [1,2,4], [1,2,3], [1,2,4], [1,2,5]]
  </code></pre>
  
  <p>I would like to assign an id to each elements, where the id is unique, except when the item is duplicated. So for the list above, I'd need this back:</p>
  
  <pre><code>[0,1,0,1,2]
  </code></pre>
  
  <p>What is the most effective way to do this?</p>