title: How to cap values in pandas within IQR respective to a column
body: <p>I wanted to clip values of a DataFrame into their inter qantile range, so that:</p>
  
  <ol>
  <li>If the actual value is higher than its 75th percentile it will default to 75th percentile value</li>
  <li>If the actual value is lower than 25th percentile it will default to 25th percentile.</li>
  <li>If the value is in between 25th and 75th percentile it will be the same value.</li>
  </ol>
  
  <p>Is there a way to do it for all columns in one go (i.e. A max becomes 3, B and C max become 2.25)</p>
  
  <pre><code>test = pd.DataFrame({'A':[1,2,3,1,2,3,1,1,2,3,1,12],
                       'B':[0,1,2,1,0,1,3,1,2,1,3,9],
                       'C':[0,1,2,2,1,2,3,1,2,1,4,17]})
  
  test.describe()
  
  
         A         B         C
  25%    1.000000  1.000000  1.000000
  75%    3.000000  2.250000  2.250000
  max    12.000000 9.000000  17.000000
  </code></pre>