Chapter 4. Convenience Functions for Your Convenience

As we have noticed, NumPy has a great number of functions. Many of these functions are there just for your convenience. Knowing these functions will greatly increase your productivity. This includes functions that select certain parts of your arrays (for instance, based on a Boolean condition) or manipulate polynomials. An example of computing correlation of stock returns is provided to give you a taste of data analysis in NumPy.

In this chapter, we shall cover the following topics:

  • Data selection and extraction
  • Simple data analysis
  • Examples of correlation of returns
  • Polynomials
  • Linear algebra functions

In the previous chapter, we had one single data file to play around with. Things have significantly improved in this chapter—we now have two data files. Let's go ahead and explore the data with NumPy.

Correlation

Have you noticed that the stock price of some companies is closely followed by another one, usually a rival in the same sector? The theoretical explanation is that, because these two companies are in the same type of business, they share the same challenges, require the same materials and resources, and compete for the same type of customers.

You could think of many possible pairs, but you would want to check whether a real relationship exists. One way is to have a look at the correlation of the stock returns of both stocks. A high correlation implies a relationship of some sort. It is not proof though, especially if you don't use sufficient data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.3.208