title: How to replace indices values in a cell with the column value in a Pandas dataframe
body: <p>I have a dataset with unique IDs and few attributes. I executed the k-d tree in Python to get the indices of each id for three nearest neighbors as shown in the following figure:
  <a href="https://i.stack.imgur.com/yYtfq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yYtfq.png" alt="enter image description here" /></a></p>
  <p>The &quot;Index&quot; in the above figure is the default indices that comes with a Pandas dataframe. I want the output in the format as shown in the figure below:
  <a href="https://i.stack.imgur.com/iJ4tS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iJ4tS.png" alt="enter image description here" /></a></p>
  <p>This can be easily accomplished in an excel using vlookup but how to do this in Python?</p>