PERF: Very slow clip performance · Issue #15400 · pandas-dev/pandas (original) (raw)
Code Sample, a copy-pastable example if possible
In [38]: s = pd.Series(np.random.randn(30))
In [39]: timeit s.clip(0, 1) 100 loops, best of 3: 2.02 ms per loop
Problem description
There is more than 1000x performance difference between Series.clip
and numpy.clip
:
In [43]: timeit np.clip(arr, 0, 1)
1000000 loops, best of 3: 1.06 µs per loop
Output of pd.show_versions()
pandas 0.19.2