Python Basics

With Illustrations from the Financial Markets

  • 0 Ratings
  • 38 Want to read
  • 3 Currently reading
  • 0 Have read

My Reading Lists:

Create a new list

Check-In

×Close
Add an optional check-in date. Check-in dates are used to track yearly reading goals.
Today

  • 0 Ratings
  • 38 Want to read
  • 3 Currently reading
  • 0 Have read


Download Options

Buy this book

Last edited by Rekhit
August 22, 2019 | History

Python Basics

With Illustrations from the Financial Markets

  • 0 Ratings
  • 38 Want to read
  • 3 Currently reading
  • 0 Have read

The material presented here is a condensed introduction to Python and its data science related libraries such as NumPy, Pandas, and Matplotlib. The illustrative examples we use are associated with the financial markets.

We think it should also be useful to
- Anyone who wants a brief introduction to Python and the key components
of its data science stack, and
- Python programmers who want a quick refresher on using Python for
data analysis.

We do not expect any of our readers to have a formal background in computer science, although some familiarity with programming would be nice to have. The concepts and ideas here are covered with several examples to help connect theory to practice.

Publish Date
Language
English

Buy this book

Previews available in: English

Book Details


Table of Contents

Contents
1 Introduction Page 1 |
1.1 What is Python? Page 1 |
1.2 Where is Python used? Page 2 |
1.3 Why Python? Page 2 |
1.4 History of Python Page 6 |
1.5 Python 3 versus Python 2 Page 7 |
1.6 Key Takeaways Page 10 |
2 Getting Started with Python Page 11 |
2.1 Python as a Calculator Page 11 |
2.1.1 Floating Point Expressions Page 14 |
2.2 Python Basics Page 17 |
2.2.1 Literal Constants Page 17 |
2.2.2 Numbers Page 18 |
2.2.3 Strings Page 18 |
2.2.4 Comments Page 19 |
2.2.5 print() function Page 20 |
2.2.6 format() function Page 22 |
2.2.7 Escape Sequence Page 23 |
2.2.8 Indentation Page 24 |
2.3 Key Takeaways Page 25 |
3 Variables and Data Types in Python Page 27 |
3.1 Variables Page 27 |
3.1.1 Variable Declaration and Assignment Page 27 |
3.1.2 Variable Naming Conventions Page 28 |
3.2 Data Types Page 31 |
3.2.1 Integer Page 31 |
3.2.2 Float Page 32 |
3.2.3 Boolean Page 34 |
3.2.4 String Page 35 |
3.2.5 Operations on String Page 38 |
3.2.6 type() function Page 41 |
3.3 Type Conversion Page 42 |
3.4 Key Takeaways Page 45 |
4 Modules, Packages and Libraries Page 47 |
4.1 Standard Modules Page 50 |
4.2 Packages Page 52 |
4.3 Installation of External Libraries Page 53 |
4.3.1 Installing pip Page 54 |
4.3.2 Installing Libraries Page 54 |
4.4 Importing modules Page 56 |
4.4.1 import statement Page 56 |
4.4.2 Selective imports Page 57 |
4.4.3 The Module Search Path Page 59 |
4.5 dir()function Page 61 |
4.6 Key Takeaways Page 63 |
5 Data Structures Page 65 |
5.1 Indexing and Slicing Page 65 |
5.2 Array Page 67 |
5.2.1 Visualizing an Array Page 67 |
5.2.2 Accessing Array Element Page 68 |
5.2.3 Manipulating Arrays Page 68 |
5.3 Tuples Page 70 |
5.3.1 Accessing tuple elements Page 71 |
5.3.2 Immutability Page 72 |
5.3.3 Concatenating Tuples Page 72 |
5.3.4 Unpacking Tuples Page 73 |
5.3.5 Tuple methods Page 73 |
5.4 Lists Page 74 |
5.4.1 Accessing List Items Page 75 |
5.4.2 Updating Lists Page 75 |
5.4.3 List Manipulation Page 77 |
5.4.4 Stacks and Queues Page 80 |
5.5 Dictionaries Page 82 |
5.5.1 Creating and accessing dictionaries Page 82 |
5.5.2 Altering dictionaries Page 85 |
5.5.3 Dictionary Methods Page 86 |
5.6 Sets Page 88 |
5.7 Key Takeaways Page 92 |
6 Keywords & Operators Page 95 |
6.1 Python Keywords Page 95 |
6.2 Operators Page 106 |
6.2.1 Arithmetic operators Page 106 |
6.2.2 Comparison operators Page 107 |
6.2.3 Logical operators Page 109 |
6.2.4 Bitwise operator Page 110 |
6.2.5 Assignment operators Page 114 |
6.2.6 Membership operators Page 118 |
6.2.7 Identity operators Page 118 |
6.2.8 Operator Precedence Page 119 |
6.3 Key Takeaways Page 121 |
7 Control Flow Statements Page 123 |
7.1 Conditional Statements Page 123 |
7.1.1 The if statement Page 123 |
7.1.2 The elif clause Page 125 |
7.1.3 The else clause Page 125 |
7.2 Loops Page 126 |
7.2.1 The while statement Page 126 |
7.2.2 The for statement Page 128 |
7.2.3 The range() function Page 128 |
7.2.4 Looping through lists Page 130 |
7.2.5 Looping through strings Page 131 |
7.2.6 Looping through dictionaries Page 131 |
7.2.7 Nested loops Page 133 |
7.3 Loop control statements Page 134 |
7.3.1 The break keyword Page 134 |
7.3.2 The continue keyword Page 135 |
7.3.3 The pass keyword Page 136 |
7.4 List comprehensions Page 137 |
7.5 Key Takeaways Page 140 |
8 Iterators & Generators Page 143 |
8.1 Iterators Page 143 |
8.1.1 Iterables Page 143 |
8.1.2 enumerate() function Page 145 |
8.1.3 The zip()function Page 146 |
8.1.4 Creating a custom iterator Page 147 |
8.2 Generators Page 149 |
8.3 Key Takeaways Page 151 |
9 Functions in Python Page 153 |
9.1 Recapping built-in functions Page 154 |
9.2 User defined functions Page 155 |
9.2.1 Functions with a single argument Page 156 |
9.2.2 Functions with multiple arguments and a return statement Page 157 |
9.2.3 Functions with default arguments Page 159 |
9.2.4 Functions with variable length arguments Page 160 |
9.2.5 DocStrings Page 162 |
9.2.6 Nested functions and non-local variable Page 164 |
9.3 Variable Namespace and Scope Page 166 |
9.3.1 Names in the Python world Page 167 |
9.3.2 Namespace Page 168 |
9.3.3 Scopes Page 169 |
9.4 Lambda functions Page 174 |
9.4.1 map() Function Page 175 |
9.4.2 filter() Function Page 176 |
9.4.3 zip() Function 177
9.5 Key Takeaways Page 179 |
10 NumPy Module Page 181 |
10.1 NumPy Arrays Page 182 |
10.1.1 N-dimensional arrays Page 185 |
10.2 Array creation using built-in functions Page 186 |
10.3 Random Sampling in NumPy Page 188 |
10.4 Array Attributes and Methods Page 192 |
10.5 Array Manipulation Page 198 |
10.6 Array Indexing and Iterating Page 203 |
10.6.1 Indexing and Subsetting Page 203 |
10.6.2 Boolean Indexing Page 205 |
10.6.3 Iterating Over Arrays Page 210 |
10.7 Key Takeaways Page 212 |
11 Pandas Module Page 215 |
11.1 Pandas Installation Page 215 |
11.1.1 Installing with pip Page 216 |
11.1.2 Installing with Conda environments Page 216 |
11.1.3 Testing Pandas installation Page 216 |
11.2 What problem does Pandas solve? Page 216 |
11.3 Pandas Series Page 217 |
11.3.1 Simple operations with Pandas Series Page 219 |
11.4 Pandas DataFrame Page 223 |
11.5 Importing data in Pandas Page 228 |
11.5.1 Importing data from CSV file Page 228 |
11.5.2 Customizing pandas import Page 228 |
11.5.3 Importing data from Excel files Page 229 |
11.6 Indexing and Subsetting Page 229 |
11.6.1 Selecting a single column Page 230 |
11.6.2 Selecting multiple columns Page 230 |
11.6.3 Selecting rows via [] Page 231 |
11.6.4 Selecting via .loc[] (By label) Page 232 |
11.6.5 Selecting via .iloc[] (By position) Page 233 |
11.6.6 Boolean indexing Page 234 |
11.7 Manipulating a DataFrame Page 235 |
11.7.1 Transpose using .T Page 235 |
11.7.2 The .sort_index() method Page 236 |
11.7.3 The .sort_values() method Page 236 |
11.7.4 The .reindex() function Page 237 |
11.7.5 Adding a new column Page 238 |
11.7.6 Delete an existing column Page 239 |
11.7.7 The .at[] (By label) Page 241 |
11.7.8 The .iat[] (By position) Page 242 |
11.7.9 Conditional updating of values Page 243 |
11.7.10 The .dropna() method Page 244 |
11.7.11 The .fillna() method Page 246 |
11.7.12 The .apply() method Page 247 |
11.7.13 The .shift() function Page 248 |
11.8 Statistical Exploratory data analysis Page 250 |
11.8.1 The info() function Page 250 |
11.8.2 The describe() function Page 251 |
11.8.3 The value_counts() function Page 252 |
11.8.4 The mean() function Page 252 |
11.8.5 The std() function Page 253 |
11.9 Filtering Pandas DataFrame Page 253 |
11.10Iterating Pandas DataFrame Page 255 |
11.11Merge, Append and Concat Pandas DataFrame Page 256 |
11.12TimeSeries in Pandas Page 259 |
11.12.1 Indexing Pandas TimeSeries Page .259 |
11.12.2 Resampling Pandas TimeSeries Page 262 |
11.12.3 Manipulating TimeSeries Page 263 |
11.13Key Takeaways Page 265 |
12 Data Visualization with Matplotlib Page 267 |
12.1 Basic Concepts Page 268 |
12.1.1 Axes Page 269 |
12.1.2 Axes method v/s pyplot Page 272 |
12.1.3 Multiple Axes Page 273 |
12.2 Plotting Page 275 |
12.2.1 Line Plot Page 276 |
12.2.2 Scatter Plot Page 289 |
12.2.3 Histogram Plots Page 294 |
12.3 Customization Page 300 |
12.4 Key Takeaways Page 313 |

Contributors

Author
Vivek Krishnamoorthy
Author
Mario Pisa Pena
Author
Jay Parmar

ID Numbers

Open Library
OL27274131M
Internet Archive
pythonbasicswithillustrationsfromthefinancialmarkets

Links outside Open Library

Community Reviews (0)

Feedback?
No community reviews have been submitted for this work.

History

Download catalog record: RDF / JSON
August 22, 2019 Edited by Rekhit Edited without comment.
August 21, 2019 Created by Rekhit Added new book.