title: Updating pandas DataFrame column does not work when iterating through rows in a for loop
body: <p>I have the following code, through which I am trying to iterate through several .csv files and finding the minimum value of some of the columns (excluding 0 values) for each of the files and then putting these minimum values in a master spreadsheet:</p>
  <pre><code>import pandas as pd
  import glob
  
  main = pd.read_csv(&quot;main.csv&quot;)
  
  for fname in glob.glob(&quot;Folder/*.csv&quot;):
      df = pd.read_csv(fname)
      bims = [100, 101, 102, 103]
      for bim in bims:
          for module in range(1, 5):
              column = f&quot;Module {module} Voltage&quot;
              min_v = df[column].loc[df[column] != 0].min()
              main.loc[main[&quot;BIM_Number&quot;] == bim, f&quot;M{module}_Vmin&quot;] = min_v
  </code></pre>
  <p>where bims is a list of integers indicating which row of the main spreadsheet to update. What this code should do (and it works if I try it for each bim value individually, i.e. not using a loop) is take the minimum value of four columns (Module voltage 1, 2, 3, 4) from the .csv file and append each value in the main dataframe object in columns M1_Vmin, M2_Vmin, M3_Vmin, M4_Vmin respectively). However the code runs fine but in the end the main dataframe is not updated. As I mentioned if I try this by just manually inputting a value from the bim list the main dataframe for the row containing that bim value is updated just fine? Any thoughts?</p>