title: Two variables whose values change at the same time
body: <p>I have this code, the value of centroid is assigned to t_cent and then t_cent enters nested for loop and comes out with a new value. The problem is after the nested for loop process, I find that centroid has also changed in conjunction with t_cent, and I don't know why.</p>
  <pre><code>def Calc_New_cent(centroids, Data):
      while True:
          t_sent = centroids
  
          for m in range(k):
              for n in range(number_of_features):
                  t_sent.iloc[m, n] = np.mean(Data[Data['clusters'] == m + 1]['{}'.format(n + 1)])
  
          if t_sent.isnull().values.any() == False:
              centroids = t_sent
              break
      return centroids
  </code></pre>