 <p>I think you can use very fast solution with <a href="http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.where.html" rel="nofollow"><code>numpy.where</code></a>:</p> <pre><code>homework2['ADJ_HDI'] = np.where(homework2['HDI'] &gt; .5, homework2['HDI'], 0) </code></pre> <p><strong>Timings</strong>:</p> <pre><code>import pandas as pd import numpy as np homework2 = pd.DataFrame({"A": [10, 8, 1, 1, 2, 2, 2], "HDI": [25, np.nan, 2.3, 2.4, 1.2, 0.3, 5.7]}) #for test 7k uncomment row bellow #homework2 = pd.concat([homework2]*1000).reset_index(drop=True) print homework2 h = homework2.copy() h1 = homework2.copy() </code></pre> <pre><code>def a(mydataframe): def adj_hdi(row): hdi = row['HDI'] if hdi&gt;.5: return hdi else: return 0 mydataframe['ADJ_HDI'] = mydataframe.apply(lambda row: adj_hdi(row), axis = 1) return mydataframe def b(homework2): homework2['ADJ_HDI'] = 0 homework2.loc[(homework2['HDI'] &gt; 0.5), ['ADJ_HDI']] = homework2['HDI'] return homework2 def c(homework2): homework2['ADJ_HDI'] = np.where(homework2['HDI'] &gt; .5, homework2['HDI'], 0) return homework2 print a(homework2) print b(h) print c(h1) </code></pre> <p><code>len(homework2) = 7</code>:</p> <pre><code>In [2]: %timeit a(homework2) 1000 loops, best of 3: 376 µs per loop In [3]: %timeit b(h) The slowest run took 4.62 times longer than the fastest. This could mean that an intermediate result is being cached 1000 loops, best of 3: 1.49 ms per loop In [4]: %timeit c(h1) The slowest run took 5.52 times longer than the fastest. This could mean that an intermediate result is being cached 1000 loops, best of 3: 283 µs per loop </code></pre> <p><code>len(homework2) = 7k</code>:</p> <pre><code>In [7]: %timeit a(homework2) 10 loops, best of 3: 106 ms per loop In [8]: %timeit b(h) 100 loops, best of 3: 2.63 ms per loop In [9]: %timeit c(h1) The slowest run took 5.30 times longer than the fastest. This could mean that an intermediate result is being cached 1000 loops, best of 3: 324 µs per loop </code></pre>