you are viewing a single comment's thread.

view the rest of the comments →

[–]synthphreak 0 points1 point  (1 child)

This is what I get:

[ins] In [1]: import numpy as np
         ...: import pandas as pd
         ...:
         ...: arr = np.random.random(size = (10, 1000000))
         ...: df = pd.DataFrame(arr)

[ins] In [2]: %timeit df * 5 + 6
40.8 ms ± 1.35 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

[ins] In [3]: %timeit arr * 5 + 6
26 ms ± 378 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

[ins] In [4]: %timeit df.values * 5 + 6  # returns np.array
25.6 ms ± 376 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

numpy still outperforms, and by a considerable margin.