title: Why is the following simple assignment statement in python taking a lot of time to execute?
body: <p>The below code snippet is taking too much time to execute. It only consist of a simple for loop and if loop. I'm pretty sure that it's not any performance issue as my system is powerful. Can someone let me know why and also any possible solution?</p>
  
  <pre><code>new_dict= {}
  for cnt,xx in enumerate(data):
      w = som.winner(xx)
  
      if w not in cluster_centers.keys():
          new_dict[w]=count
          count+=1
  
      dataframe['Values'].iloc[cnt]= new_dict[w]
  </code></pre>