208

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

0

3 Answers 3

329

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.

Sign up to request clarification or add additional context in comments.

6 Comments

You ought to have mentioned that you're the primary author of pandas. :) The book in question: shop.oreilly.com/product/0636920023784.do
Would it be fair to say that numpy primarily provides efficient arrays, whereas pandas provides efficient dictionaries? (In both cases, limited to consistent data type rather than free form.) To me (I am just beginning to look into it now), this strikes me as the underlying difference: handling of label-paired data (in 1d aka dicts and 2d aka tables). Data alignment, join, etc all become possible due to this, but for people who don't grok that underlying difference it's not even clear what those mean (e.g., what is "data alignment" of two numpy arrays?).
may be a goofy question but what do you mean by NA-friendly statistics, mentioned in your answer.
I think, he refers to statistics taking into account of missing data (NA , "Not Available" )
Cold thread, but what about performance differences bw a complex operation in numpy, for instance, but simplified syntactically in pandas? Is there a performance cost to going the high-level, easy syntax path?
|
63

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.

Comments

4

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.

Comments