title: Python: Extract unique index values and use them in a loop
body: <p>I would like to apply the loop below where for each index value the unique values of a column called SERIAL_NUMBER will be returned. Essentially I want to confirm that for each index there is a unique serial number.</p>
  <pre><code>index_values = df.index.levels
  
  for i in index_values:
      x = df.loc[[i]]
      x[&quot;SERIAL_NUMBER&quot;].unique()
  </code></pre>
  <p>The problem, however, is that my dataset has a multi-index and as you can see below it is stored in a frozen list. I am just interested in the index values that contain a long number. The word &quot;vehicle&quot; also as an index can be removed as it is repeated all over the dataset.</p>
  <p>How can I extract these values into a list so I can use them in the loop?</p>
  <pre><code>index_values
  &gt;&gt;
  FrozenList([['0557bf98-c3e0-4955-a23f-2394635ab531', '074705a3-a96a-418c-9bfe-14c37f5c4e6f', '0f47e260-0fa2-40ba-a417-7c00ea74248c', '17342ca2-6246-4150-8080-96d6125cf2b5', '26c6c0d1-0134-4b3a-a149-61dd93afab3b', '7600be43-5d0a-49b3-a1ee-fd107db5822f', 'a07f2b0c-447c-4143-a361-d7ddbffdcc77', 'b929801c-2f32-4a95-bfc4-48a05b48ee01', 'cc912023-0113-42cd-8fe7-4df4005127c2', 'e424bd02-e188-462e-a1a6-2f4ed8fe0a2d'], ['vehicle']])
  </code></pre>