title: Getting the index of all repeating element of a column, given a specified order
body: <p>I have a dataframe such as:</p>
  
  <pre><code>                Price   Ticket
  Id                            
  505          86.5000  110152           
  258          86.5000  110152           
  760          86.5000  110152           
  263          79.6500  110413           
  559          79.6500  110413           
  586          79.6500  110413           
  111          52.0000  110465           
  476          52.0000  110465           
  431          26.5500  110564           
  367          75.2500  110813           
  171          33.5000  111240
  </code></pre>
  
  <p>I want to fill a dictionnary with :
  - keys :we enumerate the number of keys in the dict (from 1 to 3 in this case)
  - values: 'Id' (aka. the index).</p>
  
  <p>For this example I would get something like: {'1': ['505', '258', '260'], '2':['263', '559', '586'], '3':['111','476']}</p>
  
  <p>The dataframe is already sorted by the 'Ticket' column, and I want it to stay that way. Why?
  I wanna be able to use the dictionnary and dataframe (still ordered by 'Ticket') to find out if any ID in the dict is associated with a sequence of name elsewhere in the dataframe. </p>
  
  <p>I've written the code below, but I get the following Error: 'IndexError: single positional indexer is out-of-bounds'.</p>
  
  <pre><code>def same_price(df=df):
      df= df.sort_values(by='Ticket')
      nucleus= dict()
      k=0
      while df.shape[0]&gt;=2:
          if df.Price.iloc[0]==df.Price.iloc[1]:
              value= df.Price.iloc[0]
              n=0
              nucleus[k]= []
              while df.Price.iloc[n]==value:
                  nucleus[k].append(df.index[n])
                  n+=1
                  if n&gt;df.shape[0]:
                      df.drop(nucleus[k], axis=0, inplace=True)
                      break 
              else:
                  df.drop(nucleus[k], axis=0, inplace=True)
                  k+=1       
          else:
              if df.shape[0]&gt;=3: 
                  df.drop(df.index[0], axis=0, inplace=True)
              else:
                  break
      return(nucleus)
  </code></pre>
  
  <p>Given the Error, I believe that Im calling the first element of an empty list. But I cant fix it.   I would like to keep that function (and upgrade it) plz guys :)</p>