COVER....1
HALF TITLE PAGE....3
TITLE PAGE....5
COPYRIGHT....6
ACKNOWLEDGMENTS....9
ABOUT THE AUTHOR....11
ABOUT THE TECHNICAL EDITOR....13
CONTENTS....15
INTRODUCTION....21
PART 1: GETTING STARTED....25
CHAPTER 1: INTRODUCTION TO PYTHON FOR BUSINESS APPLICATIONS....27
Introducing Python for Business....27
Why Python, Not a Spreadsheet?....28
Setting Up Your Tools....29
Install Python with the Anaconda Distribution (Running Python on Your Machine)....29
Launch Jupyter Notebook....30
Cloud-friendly Alternatives....30
The Python Ecosystem....31
What Is a (Jupyter) Notebook?....32
Installing Libraries Locally or in a Notebook....32
Writing Your First Python Script....33
Summary....34
Continue Your Learning....34
CHAPTER 2: BASIC MATHEMATICAL OPERATIONS IN PYTHON....35
Numbers, Variables, and Functions: The Foundations of Business Logic....35
Understanding Variables....36
Arithmetic in Python....37
Working with the math Module....38
Data Types in Python....38
Core Data Types....38
Why Data Types Matter....40
Converting Between Types....41
Business Data Structures: Arrays and Matrices....42
One-dimensional Arrays....42
Matrices: Two-dimensional Arrays....43
Data Manipulation Basics with Pandas....47
Constructing a DataFrame....47
First Looks: head(), info(), describe()....48
Working with Columns and Rows....48
Filtering with Booleans....49
Creating New Columns....49
Grouping and Aggregation....50
Joins and Merges....51
Reshaping: Pivot, Melt, Stack....52
Summary....52
Continue Your Learning....52
CHAPTER 3: VISUALIZATION FOR BUSINESS DECISION-MAKING....53
The Landscape of Visualization Tools in Python....53
Visualization Applications: Dashboarding Frameworks....54
Choosing the Right Visualization Tool for Your Work....55
Graphing Basics with Matplotlib....56
Understanding the Structure of a Plot....56
Creating and Working with Plots....57
Customizing Visualizations to Enhance Understanding....59
Plotting Options....60
Creating Effective Visuals to Communicate Business Data....61
Time-series Data and Line Charts....62
Cross-sectional Data and Bar or Pie Charts....62
Relational Data and Scatterplots....63
Other Charts You Can Create....65
Visualizing Trends and Patterns for Business Insights....66
Highlighting Seasonality and Long-term Growth....66
Comparing Categories and Segments....68
Visualizing Cumulative Effects....70
Smoothing Trends with Rolling Averages....71
Line Charts with Confidence Intervals Using Seaborn....73
Analyzing Relationships and Distributions with jointplot....76
Summary....79
Continue Your Learning....79
PART 2: APPLYING THE MATH....81
CHAPTER 4: LINEAR ALGEBRA FOR BUSINESS AND FINANCE....83
Working with Vectors and Matrices....83
Understanding Vectors....84
Understanding Matrix....85
Operations with Vectors and Matrices....86
Scalar Multiplication....87
The Dot Product....87
Norms (Vector Lengths)....88
Combining Matrices....88
Slicing Matrices....89
Matrix Multiplication....90
Transpose....91
Creating and Manipulating Vectors (and Matrices) with NumPy....91
Step 1: Compute Asset Returns from Prices....93
Step 2: Portfolio with Constant Weights....94
Step 3: Portfolio with Time-varying Weights....96
Comparing Strategies (Same Math, Different Inputs....99
Eigenvalues and Eigenvectors: Business Applications....100
What Eigenvalues and Eigenvectors Represent....100
Why Eigenvalues Matter for Long-term Stability....101
Summary....104
Continue Your Learning....104
CHAPTER 5: CALCULUS FOR BUSINESS PROBLEM SOLVING....107
Numerical Differentiation and Integration in Business Analytics....108
The Derivative: Finding the Rate of Change....108
The Second Derivative: Pinpointing the Point of Diminishing Returns....110
The Integral: Accumulating the Totals....111
The Calculus Ecosystem in Python....114
Numerical Calculus with NumPy....114
Symbolic Calculus with SymPy....115
Advanced Numerical Methods with SciPy....116
Choosing the Right Tool....117
Solving Business Growth and Pricing Models with Differential Equations....117
Sensitivity Analysis with Partial Derivatives....120
Case Study: Revenue, Cost, and Profit Analysis....122
Step 1: Understanding Marginal Cost (the Derivative of Cost)....123
Step 2: Understanding Marginal Revenue (the Derivative of Revenue)....124
Step 3: Finding the Sweet Spot with Marginal Profit....126
Summary....128
Continue Your Learning....128
CHAPTER 6: OPTIMIZATION TECHNIQUES FOR BUSINESS STRATEGY....131
The Python Optimization Ecosystem....132
A Framework for Solving Most Optimization Problems....133
The Four-step Formulation Process....133
Understanding the Local vs. Global Optima Issue....134
Applying the Framework: Profit Maximization....134
Linear Programming....136
Constrained Optimization....140
The Geometry of Optimization....140
Visualizing the Difference Between Constrained and Unconstrained Optimization....143
Real-world Applications....146
Portfolio Allocation....146
Supply Chain and Operations....152
Integer Programming for Workforce Scheduling....155
Summary....158
Continue Your Learning....158
CHAPTER 7: PROBABILITY AND STATISTICS FOR BUSINESS ANALYTICS....161
The Python Statistics Ecosystems....161
Understanding Random Variables and Distributions in Business Contexts....162
Discrete vs. Continuous Distributions....163
The Most Common Business Distributions....164
Hypothesis Testing....168
Test Statistics....169
The p-value....170
The AB Test....171
Confidence Intervals: The Other Side of the Coin....172
Linear Regression....173
Analyzing Marketing Effectiveness....175
Explaining Financial Risk Factors....177
Other Considerations....179
Logistic Regression....180
Predicting Customer Churn....180
Forecasting....185
Summary....188
Continue Your Learning....188
CHAPTER 8: APPLIED BUSINESS PROBLEMS WITH MATH AND PYTHON....191
Building a Dynamic Loan Amortization Engine....192
Building a Simple Recommender System....195
Maximizing Yield with Constrained Optimization....197
Quality Control with Hypothesis Testing....201
Predicting Employee Attrition with Logistic Regression....203
Summary....209
Continue Your Learning....209
PART 3: VISUALIZING THE NUMBERS ....211
CHAPTER 9: ILLUSTRATING TIME-SERIES AND LINEAR DATA....213
Understanding Your Data Structure....213
Cross-sectional Data....214
Time-series Data....216
Panel Data....217
Visualizing Change Over Time (Time-series)....218
Time-series Diagnostics....219
Seasonality and Autocorrelation....225
Panel Data....230
Summary....232
Continue Your Learning....233
CHAPTER 10: ILLUSTRATING CROSS-SECTIONAL DATA....235
Data Categories....235
The Pie Chart....235
Donut Charts....237
Stacked Bar Charts....240
Correlations and Distributions....241
Bar Charts....242
Boxplots....244
Correlations in the Cross Section....246
Scatterplots....246
Correlation Heatmaps....249
The Pair Plot....251
Summary....253
Continue Your Learning....254
Essential Cross-sectional Functions....254
CHAPTER 11: ILLUSTRATING ALTERNATIVE DATA TYPES....257
Textual Analysis....257
The Word Cloud....258
N-grams....260
Visualizing Customer Sentiment....263
Geospatial Data....266
The Choropleth Map....267
The Marker Map....268
The Heatmap....270
Visualizing Networks....272
Visualizing Structure....273
Weighted Graphs....276
Summary....278
Continue Your Learning....278
INDEX....281
EULA....286
A step-by-step guide for using Python to transform abstract mathematical concepts into effective, on-the-ground scripts that solve real-world business problems
Applied Math with Python: Solve Real-World Problems with Python-Based Solutions is a detailed, step-by-step guide for business professionals, analysts, and data scientists interested in using Python to perform crucial organizational tasks: optimizing inefficient supply chains, calculating probabilities, forecasting financial performance, mining customer data for new insights, and more.
Author, researcher, and Assistant Professor of Finance at the University of North Florida, Blake Rayfield uses practical examples and hands-on exercises to explain how to combine concepts from optimization, probability, statistics, and other branches of mathematics with the Python language to solve difficult, common business problems. You’ll discover how marketing managers can use Python to create useful customer segments, how to model revenue growth, and how to allocate limited resources in a product launch or expansion.
Perfect for entrepreneurs, analysts, managers, and professionals working in AI, data science, and finance, Applied Math with Python is an expert guide for transforming abstract mathematical concepts into useful, repeatable, scalable solutions you can put to work immediately in your team and in your organization.