Python中的Pandas和NumPy + SciPy有什么区别?[关闭]

问题:Python中的Pandas和NumPy + SciPy有什么区别?[关闭]

他们似乎都非常相似,我很好奇哪个软件包对财务数据分析更有利。

They both seem exceedingly similar and I’m curious as to which package would be more beneficial for financial data analysis.


回答 0

熊猫提供了基于NumPy构建的高级数据处理工具。NumPy本身是一个相当底层的工具,类似于MATLAB。另一方面,pandas提供了丰富的时间序列功能,数据对齐,对NA友好的统计信息,groupby,合并和联接方法以及许多其他便利。近年来,它在金融应用中变得非常流行。我的下一本书将专门介绍使用熊猫进行财务数据分析的一章。

pandas provides high level data manipulation tools built on top of NumPy. NumPy by itself is a fairly low-level tool, similar to MATLAB. pandas on the other hand provides rich time series functionality, data alignment, NA-friendly statistics, groupby, merge and join methods, and lots of other conveniences. It has become very popular in recent years in financial applications. I will have a chapter dedicated to financial data analysis using pandas in my upcoming book.


回答 1

熊猫(以及几乎所有用于Python的数值工具)都需要Numpy。熊猫不是严格要求Scipy,但被列为“可选依赖项”。我不会说熊猫是Numpy和/或Scipy的替代品。相反,它是一个额外的工具,它提供了更简化的方式来使用Python中的数字和表格数据。您可以使用pandas数据结构,但可以自由利用Numpy和Scipy函数进行操作。

Numpy is required by pandas (and by virtually all numerical tools for Python). Scipy is not strictly required for pandas but is listed as an “optional dependency”. I wouldn’t say that pandas is an alternative to Numpy and/or Scipy. Rather, it’s an extra tool that provides a more streamlined way of working with numerical and tabular data in Python. You can use pandas data structures but freely draw on Numpy and Scipy functions to manipulate them.


回答 2

熊猫提供了一种处理表格的好方法,因为您可以使装箱变得容易(在Python中以熊猫装箱数据框)并计算统计信息。在熊猫中另一个很棒的事情是Panel类,您可以将具有不同属性的一系列图层结合在一起,并使用groupby函数将其组合。

Pandas offer a great way to manipulate tables, as you can make binning easy (binning a dataframe in pandas in Python) and calculate statistics. Other thing that is great in pandas is the Panel class that you can join series of layers with different properties and combine it using groupby function.