Set maximum value (upper bound) in pandas DataFrame
<p>I'm trying to set a maximum value of a pandas DataFrame column.  For example:</p>

<pre><code>my_dict = {'a':[10,12,15,17,19,20]}
df = pd.DataFrame(my_dict)

df['a'].set_max(15)
</code></pre>

<p>would yield:</p>

<pre><code>    a
0   10
1   12
2   15
3   15
4   15
5   15
</code></pre>

<p>But it doesn't. </p>

<p>There are a million solutions to <em>find</em> the maximum value, but nothing to <em>set</em> the maximum value... at least that I can find.  </p>

<p>I could iterate through the list, but I suspect there is a faster way to do it with pandas.  My lists will be significantly longer and thus I would expect iteration to take relatively longer amount of time.  Also, I'd like whatever solution to be able to handle <code>NaN</code>.</p>