Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perfomance of numpy vs pandas [duplicate]

I've written a bunch of code on the assumption that I was going to use Numpy arrays. Turns out the data I am getting is loaded through Pandas. I remember now that I loaded it in Pandas because I was having some problems loading it in Numpy. I believe the data was just too large.

Therefore I was wondering, is there a difference in computational ability when using Numpy vs Pandas?

If Pandas is more efficient then I would rather rewrite all my code for Pandas but if there is no more efficiency then I'll just use a numpy array...

like image 554
Terence Chow Avatar asked Nov 19 '22 13:11

Terence Chow


1 Answers

There can be a significant performance difference, of an order of magnitude for multiplications and multiple orders of magnitude for indexing a few random values.

I was actually wondering about the same thing and came across this interesting comparison: http://penandpants.com/2014/09/05/performance-of-pandas-series-vs-numpy-arrays/

like image 143
Mark Avatar answered Jan 11 '23 23:01

Mark