title: Iterate over columns and rows (selected by label from label column) without overwriting
body: <p>I want to do the following thing:</p>
  <ol>
  <li>Get min and max for every measurement column within the same label (range of rows)</li>
  <li>Define a range for the interesting values (e.g. maximum * 0.6 up to maximum)</li>
  <li>Check for every measurement column within the same label if value lies in this interval (=True) or not (=False)</li>
  <li>Replace values outside this interval with NaN</li>
  </ol>
  <p>I have a df like this:</p>
  <pre><code>df = {'Measurement_1': [1, 2, 7, 9, 34, 67, 50], 'Measurement_2': [3, 4, 30, 22, 55, 13, 45], 'Label': ['cable', 'cable', 'cable', 'wood', 'wood', 'wood', 'wood']}
  </code></pre>
  <p>I´m getting the maximum and minimum value for every measurement and every label as a separate df and define maximum_set and minimum_set for further conditions like this:</p>
  <pre><code>df_sort = df.groupby('Label')
  measurement_values = df.columns.tolist()
  measurement_values.remove('Label')
  
  labels = df['Label'].unique().tolist()
  
  df_sort = df_sort[measurement_values]
  
  for label, data in df_sort:
      minimum = df_sort.min()
      maximum = df_sort.max()
      maximum_set = maximum
      minimum_set = maximum*0.6
  </code></pre>
  <p>Now I want to iterate over the original df to get a &quot;measurement_filtered&quot; column with a boolean value for every measurement and every label (e.g. check if all measurement_1 values lies between minimum_set and maximum_set). I´m doing this with the following loop:</p>
  <pre><code>for measurement in measurement_values:
       for label in labels: 
           df[measurement +'_filtered'] = df.loc[df['Label'] == label,measurement].between(minimum_set.loc[label][measurement],maximum_set.loc[label][measurement], inclusive ='both')
  </code></pre>
  <p>This loop gives the correct boolean entries for every measurement and label. The problem is that the for loop and the .loc are overwriting the iterations before. So the final  df_filtered columns only include the last &quot;label&quot;-iteration (in this example 'wood'), the rest of the _filtered columns is empty. I don´t know how to fix this problem.</p>