Book Image

Python for Finance

By : Yuxing Yan
Book Image

Python for Finance

By: Yuxing Yan

Overview of this book

Table of Contents (20 chapters)
Python for Finance
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 6. Introduction to NumPy and SciPy

In this chapter, we will introduce the two most important modules, called NumPy and SciPy, which are used intensively for scientific and financial computation based on Python. In this book, many chapters and modules depend on these two modules.

In particular, we will cover the following topics:

  • Installation of NumPy and SciPy

  • Launching Python from Anaconda

  • Examples of using NumPy and SciPy

  • Showing all functions in NumPy and SciPy

  • Getting more information about a specific function

  • Understanding the list data type

  • Array in NumPy, logic relationship related to arrays

  • Working with arrays of ones, zeros, and identity matrix

  • Performing array operations: +, -, *, and /

  • The x.sum() dot function

  • Looping through an array

  • A list of subpackages for SciPy

  • Cumulative standard normal distribution

  • Generating random numbers

  • Statistic submodule (stats) from SciPy

  • Interpolation, linear equations, and optimization

  • Linear regression and Capital Assets Pricing Model (CAPM)

  • Retrieving data...