Why are numpy functions so slow on pandas series / dataframes? : <p>Consider a small MWE, taken from <a href="https://stackoverflow.com/q/47881048/4909087">another question</a>:</p>

<pre><code>DateTime                Data
2017-11-21 18:54:31     1
2017-11-22 02:26:48     2
2017-11-22 10:19:44     3
2017-11-22 15:11:28     6
2017-11-22 23:21:58     7
2017-11-28 14:28:28    28
2017-11-28 14:36:40     0
2017-11-28 14:59:48     1
</code></pre>

<p>The goal is to clip all values with an upper bound of 1. My answer uses <code>np.clip</code>, which works fine.</p>

<pre><code>np.clip(df.Data, a_min=None, a_max=1)
array([1, 1, 1, 1, 1, 1, 0, 1])
</code></pre>

<p>Or, </p>

<pre><code>np.clip(df.Data.values, a_min=None, a_max=1)
array([1, 1, 1, 1, 1, 1, 0, 1])
</code></pre>

<p>Both of which return the same answer. My question is about the relative performance of these two methods. Consider - </p>

<pre><code>df = pd.concat([df]*1000).reset_index(drop=True)

%timeit np.clip(df.Data, a_min=None, a_max=1)
1000 loops, best of 3: 270 µs per loop

%timeit np.clip(df.Data.values, a_min=None, a_max=1)
10000 loops, best of 3: 23.4 µs per loop
</code></pre>

<p>Why is there such a massive difference between the two, just by calling <code>values</code> on the latter? In other words...</p>

<p><strong>Why are numpy functions so slow on pandas objects?</strong></p>
