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
andSciPy
Launching Python from
Anaconda
Examples of using
NumPy
andSciPy
Showing all functions in
NumPy
andSciPy
Getting more information about a specific function
Understanding the
list
data typeArray in
NumPy
, logic relationship related to arraysWorking with arrays of ones, zeros, and identity matrix
Performing array operations: +, -, *, and /
The
x.sum()
dot functionLooping through an array
A list of subpackages for
SciPy
Cumulative standard normal distribution
Generating random numbers
Statistic submodule (
stats
) fromSciPy
Interpolation, linear equations, and optimization
Linear regression and Capital Assets Pricing Model (CAPM)
Retrieving data...