10.12.2019 Views

Python for Finance

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Python Basics

There are several reasons why the first method is preferred:

• First, we can use a Python editor called Spyder, which is quite convenient

for writing and editing our Python programs. For example, it has several

windows (panels): one for the console, where we can type our commands

directly; one for the program editor, where we can write and edit our

programs; one for Variable Explorer,where we can view our variables and

their values; and one for help, where we can seek help.

• Second, different colors for codes or comment lines will help us avoid some

obvious typos and mistakes.

• Third, when installing Anaconda, many modules are installed

simultaneously. A module is a set of programs written by experts,

professionals, or any person around a specific topic. It could be viewed as a

toolbox for a specific task. To speed up the process of developing new tools,

a new module usually depends on the functions embedded in other, already

developed modules. This is called module dependency. One disadvantage of

such a module dependency is how to install them at the same time. For more

information about this, see Chapter 2, Introduction to Python Modules.

Installation of Python via Anaconda

We could install Python in several ways. The consequence is that we will have

different environments for writing a Python program and running a Python program.

The following is a simple two-step approach. First, we go to http://continuum.io/

downloads and find an appropriate package; see the following screenshot:

[ 2 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!