Numpy和Pandas在计算上有区别吗? [英] Is there a difference in computation for Numpy vs Pandas?
问题描述
我假设要使用Numpy数组,因此编写了很多代码.原来我要获取的数据是通过Pandas加载的.我记得现在我将其加载到Pandas中是因为在将其加载到Numpy时遇到一些问题.我认为数据太大.
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.
因此,我想知道,使用Numpy和Pandas的计算能力是否存在差异?
Therefore I was wondering, is there a difference in computational ability when using Numpy vs Pandas?
如果Pandas效率更高,那么我宁愿为Pandas重写我的所有代码,但是如果没有更高的效率,那么我将只使用一个numpy数组...
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...
推荐答案
性能可能存在显着差异,即乘法的数量级和索引几个随机变量的多个数量级.
There can be a significant performance difference, of an order of magnitude for multiplications and multiple orders of magnitude for indexing a few random vaues.
我实际上是想知道同一件事,并且遇到了一个有趣的比较: http://penandpants.com/2014/09/05/performance -of-pandas-series-vs-numpy-arrays/
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/
这篇关于Numpy和Pandas在计算上有区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!