0% found this document useful (0 votes)
58 views

Introduction to Python for Econometrics, Statistics and Data Analysis Kevin Sheppard All Chapters Instant Download

Kevin

Uploaded by

hotakybod40
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Introduction to Python for Econometrics, Statistics and Data Analysis Kevin Sheppard All Chapters Instant Download

Kevin

Uploaded by

hotakybod40
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Download the full version of the ebook at

https://ebookmass.com

Introduction to Python for Econometrics,


Statistics and Data Analysis Kevin Sheppard

https://ebookmass.com/product/introduction-to-
python-for-econometrics-statistics-and-data-
analysis-kevin-sheppard/

Explore and download more ebook at https://ebookmass.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Introduction to Python for Econometrics, Statistics and


Data Analysis. 5th Edition Kevin Sheppard.

https://ebookmass.com/product/introduction-to-python-for-econometrics-
statistics-and-data-analysis-5th-edition-kevin-sheppard/

testbankdeal.com

Introduction to Statistics and Data Analysis 6th Edition


Roxy Peck

https://ebookmass.com/product/introduction-to-statistics-and-data-
analysis-6th-edition-roxy-peck/

testbankdeal.com

Statistics and Data Analysis for Nursing Research (2nd


Edition ) 2nd Edition

https://ebookmass.com/product/statistics-and-data-analysis-for-
nursing-research-2nd-edition-2nd-edition/

testbankdeal.com

Introduction to Research Methods and Data Analysis in


Psychology Darren Langdridge

https://ebookmass.com/product/introduction-to-research-methods-and-
data-analysis-in-psychology-darren-langdridge/

testbankdeal.com
Introduction to Econometrics 3rd Edition James H. Stock

https://ebookmass.com/product/introduction-to-econometrics-3rd-
edition-james-h-stock/

testbankdeal.com

Introduction to Econometrics, Global Edition James H.


Stock

https://ebookmass.com/product/introduction-to-econometrics-global-
edition-james-h-stock/

testbankdeal.com

Introduction to Linear Regression Analysis (Wiley Series


in Probability and Statistics) 6th Edition Montgomery

https://ebookmass.com/product/introduction-to-linear-regression-
analysis-wiley-series-in-probability-and-statistics-6th-edition-
montgomery/
testbankdeal.com

An Introduction to Statistical Methods and Data Analysis


7th Edition, (Ebook PDF)

https://ebookmass.com/product/an-introduction-to-statistical-methods-
and-data-analysis-7th-edition-ebook-pdf/

testbankdeal.com

Enzymes. A Practical Introduction to Structure, Mechanism,


and Data Analysis 3rd Edition Robert A. Copeland

https://ebookmass.com/product/enzymes-a-practical-introduction-to-
structure-mechanism-and-data-analysis-3rd-edition-robert-a-copeland/

testbankdeal.com
Introduction to Python for
Econometrics, Statistics and Data Analysis
3rd Edition, 1st Revision

Kevin Sheppard
University of Oxford

Monday 9th September, 2019


2

©2019 Kevin Sheppard


Changes since the Third Edition

• Verified that all code and examples work correctly against 2019 versions of modules. The notable
packages and their versions are:

– Python 3.7 (Preferred version)


– NumPy: 1.16
– SciPy: 1.3
– pandas: 0.25
– matplotlib: 3.1

• Python 2.7 support has been officially dropped, although most examples continue to work with 2.7.
Do not Python 2.7 in 2019 for numerical code.

• Small typo fixes, thanks to Marton Huebler.

• Fixed direct download of FRED data due to API changes, thanks to Jesper Termansen.

• Thanks for Bill Tubbs for a detailed read and multiple typo reports.

• Updated to changes in line profiler (see Ch. 24)

• Updated deprecations in pandas.

• Removed hold from plotting chapter since this is no longer required.

• Thanks for Gen Li for multiple typo reports.

• Tested all code on Pyton 3.6. Code has been tested against the current set of modules installed by
conda as of February 2018. The notable packages and their versions are:

– NumPy: 1.13
– Pandas: 0.22
ii
Notes to the 3rd Edition

This edition includes the following changes from the second edition (August 2014):

• Rewritten installation section focused exclusively on using Continuum’s Anaconda.

• Python 3.5 is the default version of Python instead of 2.7. Python 3.5 (or newer) is well supported by
the Python packages required to analyze data and perform statistical analysis, and bring some new
useful features, such as a new operator for matrix multiplication (@).

• Removed distinction between integers and longs in built-in data types chapter. This distinction is
only relevant for Python 2.7.

• dot has been removed from most examples and replaced with @ to produce more readable code.

• Split Cython and Numba into separate chapters to highlight the improved capabilities of Numba.

• Verified all code working on current versions of core libraries using Python 3.5.

• pandas

– Updated syntax of pandas functions such as resample.


– Added pandas Categorical.
– Expanded coverage of pandas groupby.
– Expanded coverage of date and time data types and functions.

• New chapter introducing statsmodels, a package that facilitates statistical analysis of data. statsmod-
els includes regression analysis, Generalized Linear Models (GLM) and time-series analysis using
ARIMA models.
iv
Changes since the Second Edition

• Fixed typos reported by a reader – thanks to Ilya Sorvachev

• Code verified against Anaconda 2.0.1.

• Added diagnostic tools and a simple method to use external code in the Cython section.

• Updated the Numba section to reflect recent changes.

• Fixed some typos in the chapter on Performance and Optimization.

• Added examples of joblib and IPython’s cluster to the chapter on running code in parallel.

• New chapter introducing object-oriented programming as a method to provide structure and orga-
nization to related code.

• Added seaborn to the recommended package list, and have included it be default in the graphics
chapter.

• Based on experience teaching Python to economics students, the recommended installation has
been simplified by removing the suggestion to use virtual environment. The discussion of virtual
environments as been moved to the appendix.

• Rewrote parts of the pandas chapter.

• Changed the Anaconda install to use both create and install, which shows how to install additional
packages.

• Fixed some missing packages in the direct install.

• Changed the configuration of IPython to reflect best practices.

• Added subsection covering IPython profiles.

• Small section about Spyder as a good starting IDE.


vi
Notes to the 2nd Edition

This edition includes the following changes from the first edition (March 2012):

• The preferred installation method is now Continuum Analytics’ Anaconda. Anaconda is a complete
scientific stack and is available for all major platforms.

• New chapter on pandas. pandas provides a simple but powerful tool to manage data and perform
preliminary analysis. It also greatly simplifies importing and exporting data.

• New chapter on advanced selection of elements from an array.

• Numba provides just-in-time compilation for numeric Python code which often produces large per-
formance gains when pure NumPy solutions are not available (e.g. looping code).

• Dictionary, set and tuple comprehensions

• Numerous typos

• All code has been verified working against Anaconda 1.7.0.


Visit https://ebookmass.com
now to explore a rich
collection of eBooks and enjoy
exciting offers!
viii
Contents

1 Introduction 1
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Important Components of the Python Scientific Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Using Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.A Additional Installation Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2 Python 2.7 vs. 3 (and the rest) 19


2.1 Python 2.7 vs. 3.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2 Intel Math Kernel Library and AMD’s GPUOpen Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.3 Other Variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.A Relevant Differences between Python 2.7 and 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3 Built-in Data Types 23


3.1 Variable Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2 Core Native Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.3 Additional Container Data Types in the Standard Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.4 Python and Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

4 Arrays and Matrices 39


4.1 Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2 Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.3 1-dimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.4 2-dimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.5 Multidimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.6 Concatenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.7 Accessing Elements of an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.8 Slicing and Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.9 import and Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
x CONTENTS

4.10 Calling Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52


4.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

5 Basic Math 57
5.1 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.2 Broadcasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.3 Addition (+) and Subtraction (-) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.4 Multiplication (*) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.5 Matrix Multiplication (@) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.6 Array and Matrix Division (/) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.7 Exponentiation (**) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.8 Parentheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.9 Transpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.10 Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

6 Basic Functions and Numerical Indexing 63


6.1 Generating Arrays and Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.2 Rounding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.3 Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.4 Complex Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.5 Set Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.6 Sorting and Extreme Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.7 Nan Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
6.8 Functions and Methods/Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
6.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

7 Special Arrays 77
7.1 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

8 Array and Matrix Functions 79


8.1 Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
8.2 Shape Information and Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
8.3 Linear Algebra Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
8.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

9 Importing and Exporting Data 93


9.1 Importing Data using pandas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
9.2 Importing Data without pandas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
9.3 Saving or Exporting Data using pandas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
9.4 Saving or Exporting Data without pandas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
9.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
CONTENTS xi

10 Inf, NaN and Numeric Limits 103


10.1 inf and NaN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
10.2 Floating point precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
10.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

11 Logical Operators and Find 107


11.1 >, >=, <, <=, ==, != . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
11.2 and, or, not and xor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
11.3 Multiple tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
11.4 is* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
11.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

12 Advanced Selection and Assignment 113


12.1 Numerical Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
12.2 Logical Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
12.3 Performance Considerations and Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
12.4 Assignment with Broadcasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
12.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

13 Flow Control, Loops and Exception Handling 127


13.1 Whitespace and Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
13.2 if . . . elif . . . else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
13.3 for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
13.4 while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
13.5 try . . . except . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
13.6 List Comprehensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
13.7 Tuple, Dictionary and Set Comprehensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
13.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

14 Dates and Times 137


14.1 Creating Dates and Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
14.2 Dates Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
14.3 Numpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

15 Graphics 141
15.1 seaborn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
15.2 2D Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
15.3 Advanced 2D Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
15.4 3D Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.5 General Plotting Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
15.6 Exporting Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
15.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
xii CONTENTS

16 pandas 161
16.1 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
16.2 Statistical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
16.3 Time-series Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
16.4 Importing and Exporting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
16.5 Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
16.6 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

17 Structured Arrays 203


17.1 Mixed Arrays with Column Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
17.2 Record Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206

18 Custom Function and Modules 207


18.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
18.2 Variable Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
18.3 Example: Least Squares with Newey-West Covariance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
18.4 Anonymous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
18.5 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
18.6 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
18.7 PYTHONPATH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
18.8 Python Coding Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
18.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
18.A Listing of econometrics.py . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

19 Probability and Statistics Functions 225


19.1 Simulating Random Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
19.2 Simulation and Random Number Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
19.3 Statistics Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
19.4 Continuous Random Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
19.5 Select Statistics Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
19.6 Select Statistical Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
19.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241

20 Statistical Analysis with statsmodels 243


20.1 Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

21 Non-linear Function Optimization 247


21.1 Unconstrained Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
21.2 Derivative-free Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
21.3 Constrained Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
21.4 Scalar Function Minimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
21.5 Nonlinear Least Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
CONTENTS xiii

21.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

22 String Manipulation 259


22.1 String Building . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
22.2 String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
22.3 Formatting Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
22.4 Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
22.5 Safe Conversion of Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

23 File System Operations 271


23.1 Changing the Working Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
23.2 Creating and Deleting Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
23.3 Listing the Contents of a Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
23.4 Copying, Moving and Deleting Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
23.5 Executing Other Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
23.6 Creating and Opening Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
23.7 Reading and Writing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
23.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

24 Performance and Code Optimization 277


24.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
24.2 Timing Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
24.3 Vectorize to Avoid Unnecessary Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
24.4 Alter the loop dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
24.5 Utilize Broadcasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
24.6 Use In-place Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
24.7 Avoid Allocating Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
24.8 Inline Frequent Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
24.9 Consider Data Locality in Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
24.10Profile Long Running Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
24.11Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

25 Improving Performance using Numba 287


25.1 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
25.2 Supported Python Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
25.3 Supported NumPy Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
25.4 Diagnosing Performance Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
25.5 Replacing Python function with C functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
25.6 Other Features of Numba . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
25.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
xiv CONTENTS

26 Improving Performance using Cython 303


26.1 Diagnosing Performance Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
26.2 Interfacing with External Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
26.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316

27 Executing Code in Parallel 319


27.1 map and related functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
27.2 multiprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
27.3 joblib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
27.4 IPython’s Parallel Cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
27.5 Converting a Serial Program to Parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
27.6 Other Concerns when executing in Parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

28 Object-Oriented Programming (OOP) 335


28.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
28.2 Class basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
28.3 Building a class for Autoregressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
28.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

29 Other Interesting Python Packages 347


29.1 scikit-learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
29.2 mlpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
29.3 NLTK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
29.4 pymc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
29.5 pystan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
29.6 pytz and babel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
29.7 rpy2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
29.8 PyTables and h5py . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
29.9 Theano . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348

30 Examples 349
30.1 Estimating the Parameters of a GARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
30.2 Estimating the Risk Premia using Fama-MacBeth Regressions . . . . . . . . . . . . . . . . . . . . . . . . . 354
30.3 Estimating the Risk Premia using GMM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
30.4 Outputting LATEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360

31 Quick Reference 363


31.1 Built-ins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
31.2 NumPy (numpy) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
31.3 SciPy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
31.4 Matplotlib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
31.5 pandas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
CONTENTS xv

31.6 IPython . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395


xvi CONTENTS
Visit https://ebookmass.com
now to explore a rich
collection of eBooks and enjoy
exciting offers!
Chapter 1

Introduction

1.1 Background

These notes are designed for someone new to statistical computing wishing to develop a set of skills nec-
essary to perform original research using Python. They should also be useful for students, researchers or
practitioners who require a versatile platform for econometrics, statistics or general numerical analysis
(e.g. numeric solutions to economic models or model simulation).
Python is a popular general–purpose programming language that is well suited to a wide range of prob-
lems.1 Recent developments have extended Python’s range of applicability to econometrics, statistics, and
general numerical analysis. Python – with the right set of add-ons – is comparable to domain-specific
languages such as R, MATLAB or Julia. If you are wondering whether you should bother with Python (or
another language), an incomplete list of considerations includes:
You might want to consider R if:

• You want to apply statistical methods. The statistics library of R is second to none, and R is clearly
at the forefront of new statistical algorithm development – meaning you are most likely to find that
new(ish) procedure in R.

• Performance is of secondary importance.

• Free is important.

You might want to consider MATLAB if:

• Commercial support and a clear channel to report issues is important.

• Documentation and organization of modules are more important than the breadth of algorithms
available.

• Performance is an important concern. MATLAB has optimizations, such as Just-in-Time (JIT) com-
pilation of loops, which is not automatically available in most other packages.

You might want to consider Julia if:


1
According to the ranking on http://www.tiobe.com/tiobe-index/, Python is the 5th most popular language. http://
langpop.corger.nl/ ranks Python as 4th or 5th .
2 Introduction

• Performance in an interactive based language is your most important concern.

• You don’t mind learning enough Python to interface with Python packages. The Julia ecosystem is
in its infancy and a bridge to Python is used to provide important missing features.

• You like living on the bleeding edge and aren’t worried about code breaking across new versions of
Julia.

• You like to do most things yourself.

Having read the reasons to choose another package, you may wonder why you should consider Python.

• You need a language which can act as an end-to-end solution that allows access to web-based ser-
vices, database servers, data management and processing and statistical computation. Python can
even be used to write server-side apps such as a dynamic website (see e.g. http://stackoverflow.
com), apps for desktop-class operating systems with graphical user interfaces, or apps for tablets and
phones apps (iOS and Android).

• Data handling and manipulation – especially cleaning and reformatting – is an important concern.
Python is substantially more capable at data set construction than either R or MATLAB.

• Performance is a concern, but not at the top of the list.2

• Free is an important consideration – Python can be freely deployed, even to 100s of servers in on a
cloud-based cluster (e.g. Amazon Web Services, Google Compute or Azure).

• Knowledge of Python, as a general purpose language, is complementary to R/MATLAB/Julia/Ox/-


GAUSS/Stata.

1.2 Conventions

These notes will follow two conventions.

1. Code blocks will be used throughout.


"""A docstring
"""

# Comments appear in a different color

# Reserved keywords are highlighted


and as assert break class continue def del elif else
except exec finally for from global if import in is
lambda not or pass print raise return try while with yield

# Common functions and classes are highlighted in a


# different color. Note that these are not reserved,

2
Python performance can be made arbitrarily close to C using a variety of methods, including Numba (pure python), Cython
(C/Python creole language) or directly calling C code. Moreover, recent advances have substantially closed the gap with respect
to other Just-in-Time compiled languages such as MATLAB.
Random documents with unrelated
content Scribd suggests to you:
angered, fierce, terrible, has rallied the cream of his armies around him. The
sixth assault has just been repulsed, the breach cleared by a terrific fusillade
from that handful of men, whilst a murderous shower from above, of
granite and scrap-iron and heavy stones, has scattered the attacking party. A
fragment of stone has hit the Duke on the forehead; blood is streaming
down his face. He sets spurs to his horse and gallops to where a company of
archers is scrambling helter-skelter out of the moat.

'Cowards!' he cries savagely. 'Will you flee before such rabble?'

He strikes at the soldiers with his sword, sets spurs to his horse until the
poor beast snorts with pain, rears and paws the air with its hoofs, only to
bring them down the next moment, trampling and kicking half a dozen
soldiers to death in its mad and terrified struggle.

'You know the guard has fled,' Alexander Farnese cries to his officers.
''Tis only an undisciplined mob who is in there now.'

His nephew, Don Miguel de Salvado, a brave and experienced captain,


shrugs his shoulders and retorts:

'A mob led by a man who has the whole art of warfare at his finger-tips.
Look at him now!'

All eyes are turned in the direction to which Don Miguel is pointing.
There, in the midst of smouldering ruins of charred débris and crumbling
masonry, stands the defender of Cambray; behind him the graceful steeples
of St. Géry and of St. Waast, the towers of Notre Dame and of the Town
Hall, are lit up by the honey-coloured rays of the sinking sun. Superb in his
tattered clothes, with chest and arms bare, and ragged hose, he stands
immovable, scanning the western sky.

De Landas laughs aloud.

'He is still on the look-out for that promised help from France,' he says,
with a shrug of his shoulder.
The traitor has made good his escape out of the city which he has
betrayed. What assistance he could render to the Duke in the way of
information, he has done. The measure of his infamy is full to the brim, and
yet his hatred for the enemy who has shamed him is in no way assuaged.

He, too, looks up and sees Gilles de Crohin, the man whose invincible
courage has caused the Spanish armies so many valuable lives this day and
such unforgettable humiliation.

'A hundred doubloons,' he cries aloud, 'to the first man who lays that
scoundrel low!'

The word is passed from mouth to mouth. The archers and musketeers
set up a cheer. Parma adds, with an oath: 'And a captain's rank to boot!'

An hundred doubloons and a captain's rank! 'Tis a fortune for any man.
It means retirement, a cottage in sunny Spain, a home, a wife. The men take
heart and look to their arrows and their muskets! Every archer feels that he
has that fortune in his quiver now and every musketeer has it in his powder
horn. And with a loud cry of 'Long live King Philip of Spain!' the infantry
once more rush for the breach.

IV

Don Miguel de Salvado leads the attack this time. The breach now looks
like a gate which leads straight into the heart of the city, where pillage and
looting are to be the reward of the conquerors; and the booty will be rich
with the precious belongings of a pack of overfed bourgeois.

That open gate for the moment seems undefended. It is encumbered with
fallen masonry, and beyond this appear piles of rubbish, overturned wagons,
furniture, débris of all sorts, evidently abandoned by the wretched
inhabitants when they fled from their homes. Of Gilles de Crohin and his
burghers there is for the moment no sign.
Don Miguel has with him half a company of musketeers, the finest
known in Europe, and a company of lancers who have been known to clear
an entire city of rebels by their irresistible onrush.

'No falling back, remember!' he commands. 'The first who gives ground
is a dead man!'

Up the lancers run on the slippery ground, clinging to the wet earth with
naked feet, to the coarse grass and loose stones with their knees. The
musketeers remain on the hither side of the moat, three deep in a long battle
array; the front lying flat upon the ground, the second kneeling, the third
standing, with their muskets levelled against the first enemy who dares to
show his face. The pikemen have reached the breach. There is silence on
the other side. The officer laughs lustily.

'I told you 'twas but a rabble playing with firearms!'

The words are hardly out of his mouth when a terrific volley of musketry
shakes the fast crumbling wall to its foundation. It comes from somewhere
behind all those débris—and not only from there, but from some other
unknown point, with death-like precision and cold deliberation. The
Spanish officer is hit in the face; twelve pikemen throw up their arms and
come rolling down on the wet ground.

'What is this hell let loose?' cries the officer savagely, ere he too, blinded
with the flow of blood down his face, beats a hasty retreat.

Quick! a messenger to His Highness the Duke of Parma! The breach is


so wide now that twenty men could walk easily through it. The enemy is
not in sight—and yet, from somewhere unseen, death-dealing musketry
frustrates every assault.

'Return to the charge!' is the Duke of Parma's curt command, and sends
one of his ablest officers to lead a fresh charge. He himself organizes a
diversion, crosses the small rivulet, which flows into the Schelde at the foot
of Cantimpré, and trains his artillery upon a vulnerable piece of wall,
between the bastion and the river bank. He has the finest culverines known
in Europe at this time, made on a new pattern lately invented in England;
his cannon balls are the most powerful ever used in warfare, and some of
his musketeers know how to discharge ten shots in a quarter of an hour—an
accomplishment never excelled even by the French.

So, while one of his ablest officers is in charge of the attacking party on
the breach, His Highness himself directs a new set of operations. Once
more the roar of artillery and of musketry rend the air with their portentous
sound. The Duke of Parma's picked men attack the last bastion of
Cantimpré, whilst from the roads of Arras, of Sailly and Bapaume, the
whole of the Spanish infantry rush like a mighty wave to the charge.

Pikemen and halberdiers, archers and lancers, once more to the assault!
Are ye indeed cowards, that a pack of Flemish rabble can hold you at bay
till you sink back exhausted and beaten? Up, Bracamonte and Ribeiras!
Messar, with your musketeers! Salvado, with your bow-men! Up, ye mighty
Spanish armies, who have seen the world at your feet! With Farnese himself
to lead you, the hero of an hundred sieges, the queller of an hundred
rebellions; are ye dolts and fools that you cannot crush a handful of
undisciplined rabble?

And in close masses, shoulder to shoulder, they come!—exhausted, but


still obstinate, and with the hope of all the rich booty to lure them on. Down
the declivity of the moat—no longer deep, now that it is filled with dead!
And up again to below the walls! The setting sun is behind them and
gleams on their breastplates and their bonnets, and gilds the edges of the
battlements with lines of flame.

And, up on the crumbling battlements, the defenders of Cambray—the


clerks and shopkeepers and churls—hear the tramp of many feet, feel the
earth quivering beneath this thunder of a last mighty assault. Sturdy,
undaunted hands grip lance and pike tighter still, and intrepid hearts wait
for this final charge, as they have waited for others to-day, and will go on
waiting till the last of them has stilled its beating.

And Gilles de Crohin in their midst, invincible and cool, scours the
battlements and the breach, the bastions and the ramparts—always there
where he is needed most, where spirits want reviving or courage needs the
impetus of praise. He knows as well as they do that gunpowder is running
short, that arrows are few and thousands of weapons broken with usage: he
knows, better than they do, that if de Balagny's troop tarries much longer all
this heroic resistance will have been in vain.

So he keeps his own indomitable little army on the leash, husbanding


precious lives and no less precious ammunition; keeping them back, well
away from the parapets, lest the sight of the enemy down below lead them
on to squander both. Thus, of all that goes on beneath the walls, of the
nature of the attack or the chances of a surprise, the stout defenders can see
nothing. Only Gilles, whilst scouring the lines, can see; for he has crawled
on his hands and knees to the outermost edge of the crumbling parapet and
has gazed down upon the Duke of Parma's hordes.

Now the Spanish halbertmen have reached the hither side of the moat.
The breach is before them, tantalizingly open. The lancers are following
over the improvised bridges, and behind them the musketeers are sending a
volley of shot over their heads into the breach. It is all done with much
noise and clash of steel and thundering artillery and cries of 'Long live King
Philip!'—all to cover the disposing of scaling ladders against the walls.

The pikemen are executing this surprise attack, one in which they are
adepts. The noisy onslaught, the roar of artillery, the throwing of dust in the
eyes of wearied defenders; then the silent scaling of the walls, the rush upon
the battlements, wholesale panic and slaughter.

Alexander Farnese hath oft employed these devices and hath never
known them to fail. So the men throw down their pikes, carry pistols in
their right hand and a short dagger-like sword between their teeth. They fix
their ladders—five of them—and begin quite noiselessly to mount. Ten on
each ladder, which makes fifty all told, and they the flower of the Duke of
Parma's troops. Up they swarm like human ants striving to reach a hillock.
Now the gunners have to cease firing, lest they hit those ladders with their
human freight.
And while at the breach the men of Cambray make their last desperate
stand, the first of the Spanish pikemen has reached the topmost rung of his
ladder. The human ants have come to the top of their hillock. Already the
foremost amongst them has begun to hoist himself up, with his hands
clinging to the uneven masonry. The next second or two would have seen
him with his leg over the parapet, and already a cry of triumph has risen to
his lips, when suddenly, before his horror-stricken gaze, a man surges up, as
if out of the ground, stands there before him for one second, which is as
tense as it is terrifying. Then, with a mighty blow from some heavy weapon
which he holds, he fells the pikeman down. The man loses his footing,
gives a loud cry of horror and falls headlong some forty feet. In his fall he
drags two or three of his comrades with him. But the ladder still stands, and
on it the human ants, reinforced at once by others, resume their climb. Only
for a minute—no more! The next, a pair of hands with titanic strength and a
grip of iron seizes the ladder by the shafts, holds it for one brief, agonizing
moment, and then hurls it down with the whole of its human freight into the
depth below.

An awful cry rends the air, but is quickly drowned by the roar of cannon
and musketry. It has been a mere incident. The Duke has not done more
than mutter an oath in his beard. He is watching the four other ladders on
which his human ants are climbing. But the oath dies on his lips—even he
becomes silent in face of the appalling catastrophe which he sees. That man
up there whom already he has learned to fear, that man in the tattered
doublet and the ragged hose—he it is who has turned the tables on Farnese's
best ruse de guerre. With lightning rapidity and wellnigh superhuman
strength, he repeats his feat once more. Once more a scaling ladder bearing
its precious human freight is hurled down into the depth. The man now
appears like a Titan. Ye gods! or ye devils! which of you gave him that
strength? Now he has reached the third ladder. Just perhaps one second too
late, for the leading pikeman has already gained a foothold upon the
battlements, stands there on guard to shield the ladder; for he has scented
the danger which threatens him and his comrades. His pistol is raised even
as Gilles approaches. The Duke of Parma feels as if his heart had stilled its
beating. Another second, and that daring rebel would be laid low.
But Gilles too has seen the danger—the danger to himself and to the city
which he is defending. No longer has he the time to seize the ladder as he
has done before, no longer the chance of exerting that titanic strength which
God hath lent him so that he might save Cambray. One second—it is the
most precious one this threatened city hath yet known, for in it Fate is
holding the balance, and the life of her defender is at stake. One second!

The Spanish pikemen are swarming up dangerously near now to the


battlements. The next instant Gilles has picked up a huge piece of masonry
from the ground, holds it for one moment with both hands above his head,
then hurls it with all his might against the ladder. The foremost man is the
first to fall. His pistol goes off in his hand with a loud report. Immediately
below him the weight of the falling stone has made matchwood of the
ladder and the men are hurled to their death, almost without uttering a
groan. The Flemish halbertmen in the meanwhile have rushed up to the
battlements; seeing Gilles' manoeuvre, they are eager to emulate it. There
are two more ladders propped against the falling walls and their leader's
strength must in truth be spent. And there are still more Spaniards to come,
more of those numberless hordes, before whom a handful of untrained
burghers are making their last and desperate stand.

Just then Gilles has paused in order to gaze once more into the far-away
west. Already the gold of the sun has turned to rose and crimson, already
the low-lying horizon appears aflame with the setting glow. But now upon
the distant horizon line something appears to move, something more swift
and sudden and vivid than the swaying willows by the river bank or the tall
poplars nodding to the evening breeze. Flames of fire dart and flash, a
myriad specks of dust gleam like lurid smoke and the earth shakes with the
tramp of many horses' hoofs. Far away on the Bapaume road the
forerunners of de Balagny's troops are seen silhouetted against the glowing
sky.

Gilles has seen them. Aid has come at last. One more stupendous effort,
one more superhuman exertion of will, and the day is won. He calls aloud
to the depleted garrison, to that handful of men who, brave and undaunted,
stand around him still.
'At them, burghers of Cambray! France comes to your aid! See her
mighty army thundering down the road! Down with the Spaniard! This is
the hour of your victory!'

As many times before, his resonant voice puts heart into them once
again. Once again they grip halberds and lances with the determination born
of hope. They rush to the battlements and with mighty hands hurl the
Spanish scaling ladders from their walls, pick up bits of stone, fragments of
granite and of iron, use these as missiles upon the heads of the attacking
party below. The archers on one knee shoot with deadly precision. They
have been given half a dozen arrows each—the last—and every one of them
finds its mark.

Surprised and confounded by this recrudescence of energy, the Spaniards


pause. An hundred of them lie dead or dying at the foot of the wall. Their
ranks are broken; don Miguel tries to rally them. But he is hit by an arrow
in the throat, ere he succeeds. De Landas is close by, runs to the rescue, tries
to re-form the ranks, and sees Gilles de Crohin standing firm upon the
battlements and hears his triumphant, encouraging cry:

'Citizens of Cambray, France has come to your aid!'

Confusion begins to wave her death-dealing wand. The halbertmen at the


breach stand for full five minutes almost motionless under a hail of arrows
and missiles, waiting for the word of command.

And on the Bapaume road, de Balagny and his troops are quickly
drawing nigh. Already the white banner with the gold Fleur-de-Lys stands
out clearly against the sky.

Parma has seen it, and cursed with savage fury. He is a great and mighty
warrior and knows that the end has come. The day has brought failure and
disgrace; duty now lies in saving a shred of honour and the remnants of a
scattered army. He cannot understand how it has all happened, whence this
French troop has come and by whose orders. He is superstitious and
mystical and fears to see in this the vengeful finger of God. So he crosses
himself and mutters a quick prayer, even as a volley of musketry fired
insolently into the air, reverberates down the Bapaume road.
France is here with her great armies, her unconquered generals: Condé,
Turenne, have come to the rescue. Parma's wearied troops cannot possibly
stand the strain of fighting in the rear whilst still pushing home the attack in
front. How numerous is the French advancing troop it is impossible to
guess. They come with mighty clatter and many useless volleys of
musketry, with jingling of harness and breastplates and clatter of hoofs
upon the road. They come with a mighty shout of 'Valois! and Fleur-de-
Lys!' They wave their banners and strike their lances and pikes together.
They come! They come!

And the half-exhausted Spanish army hears and sees them too. The
halbertmen pause and listen, the archers halt halfway across the moat,
whilst all around the whisper goes from mouth to mouth:

"The French are on us! Sauve qui peut!"

Panic seizes the men. They turn and scurry back over the declivity of the
moat. The stampede has commenced: first the cavalry, then the
infantrymen, for the French are in the rear and legions of unseen spirits
have come to the aid of Cambray.

The Duke of Parma now looks like a broken wreck of his former
arrogant self. His fine accoutrements are torn, the trappings of his charger
are in tatters, his beard has been singed with gunpowder, he has no hat, no
cloak. Raging fury is in his husky voice as he shouts orders and counter-
orders to men who no longer hear. He calls to his officers, alternately
adjures and insults them. But the French troops draw nearer and nearer, and
nothing but Death will stop those running Spanish soldiers now.

To right and left of the Bapaume road they run, leaving that road free for
the passage of de Balagny's small troop. Out in the western sky, the sun is
setting in a mantle of vivid crimson, which is like the colour of human
blood. The last glow illumines the final disgrace of Parma's hitherto
unconquered hordes. The cavalry is galloping back to the distant camp, with
broken reins and stirrups hanging loose, steel bonnets awry, swords, lances,
broken or wilfully thrown aside. Behind them, the infantry, the archers, the
pikemen, the halberdiers—all running and dragging their officers away with
them in their flight.
Parma's unconquered army has ceased to be.

VI

Then it is that Gilles de Crohin stands once again on the very edge of the
broken parapet and fronts the valiant men of Cambray, who have known
how to conquer and how to die. The setting sun draws lines of glowing
crimson round his massive figure. His clothes are now mere tattered rags;
he is bleeding from several wounds; his face is almost unrecognizable, coal-
black with grime and powder; but his eyes still sparkle with pride of
victory.

'Citizens of Cambray, you are free!' he cries. 'Long live France! Long
live the Flower o' the Lily!'

And down in the plain below, where the remnants of a disintegrated


army are being slowly swallowed up by the gathering dusk, the Duke of
Parma has paused for one moment before starting on his own headlong
flight. He sees the man who has beaten his mighty armies, the man whose
valour and indomitable will has inflicted untarnishable humiliation upon the
glory of Spain. With a loud curse, he cries:

'Will no one rid me of that insolent rebel?'

De Landas is near him just then. He too had paused to look once again
on the city which had been his home and which he had so basely betrayed,
and once again on the man whom he hated with an intensity of passion
which this day of glory and infamy had for ever rendered futile.

'If I do,' he retorts exultantly, 'what will your Highness give me?'

'Cambray and all it contains,' replies the Duke fiercely.

De Landas gives a cry of prescient triumph. A lancer is galloping by.


The young man, with a swift, powerful gesture, seizes the horse by the
bridle, forces it back on its haunches till it rears and throws its rider down
into the mud. De Landas swings himself into the saddle, rides back to
within a hundred paces of the city walls. Here confusion is still holding
sway; belated runaways are darting aimlessly hither and thither like helpless
sheep; the wounded and the maimed are making pitiable efforts to find a
corner wherein to hide. The ground is littered with the dead and the dying,
with abandoned cannon and spent arrows, with pikes and halberts and
broken swords and lances.

De Landas halts, jumps down from his horse, looks about him for a
crossbow and a quiver, and finds what he wants. Then he selects his
position carefully, well under cover and just near enough to get a straight hit
at the man whom he hates more than anything else in the world.
Opportunity seems to favour him. Gilles is standing well forward on the
broken parapet, his throat and chest are bare, his broad figure stands out
clear-cut against the distant sky. He is gazing out towards the west, straight
in the direction where de Landas is cowering—a small, unperceived unit in
the inextricable confusion which reigns around.

He has found the place which best suits his purpose, has placed his stock
in position and adjusted his arrow. Being a Spanish gentleman, he is well
versed in the use of every weapon necessary for war. He takes careful aim,
for he is in no hurry and is determined not to miss.

'Cambray and all it contains!' the Duke of Parma has promised him if he
succeeds in his purpose.

One second, and the deed is done. The arrow has whizzed through the
air. The next instant, Gilles de Crohin has thrown up his arms.

'Citizens of Cambray, wait for France!' he cries, and before any of his
friends can get to him, he has given one turn and then fallen backwards into
the depth below.

De Landas has already thrown down his crossbow, recaptured his horse
and galloped back at break-neck speed in the wake of the flying army.

And even then the joy-bells of Cambray begin to ring their merry peal.
Balagny's troops have entered the city through the open breach in her walls,
whilst down there in the moat, on a pile of dying and dead, her defender and
saviour lies with a murderous arrow in his breast.

VII

De Landas rides like one possessed away from the scene of his dastardly
deed; nor does he draw rein till he has come up once more with the Duke of
Parma.

'At any rate, we are rid of him,' he says curtly. 'And next time we attack,
it will only be with an undisciplined mob that we shall have to deal.'

All around him the mighty army of Parma is melting like snow under the
first kiss of a warm sun. Every man who hath limbs left wherewith to run,
flies panic-stricken down the roads, across fields and rivulets and morasses,
throwing down arms, overturning everything that comes in his way, not
heeding the cries of the helpless and trampling on the dead.

Less than an hour has gone by since France's battle-cry first resounded
on the Bapaume road, and now there is not one Spanish soldier left around
the walls of Cambray, save the wounded and the slain. These lie about
scattered everywhere, like pawns upon an abandoned chess-board. The
moat below the breach is full of them. Maître Jehan le Bègue has not far to
seek for the master and comrade whom he loves so dearly. He has seen him
fall from the parapet, struck by the cowardly hand of an assassin in the very
hour of victory. So, whilst de Balagny's chief captains enter Cambray in
triumph, Jehan seeks in the moat for the friend whom he has lost.

He finds him lying there with de Landas' arrow still sticking in the
wound in his breast. Maître Jehan lifts him as tenderly as a mother would
lift her sick child, hoists him across his broad shoulders, and then slowly
wends his way along the road back to La Fère.
CHAPTER XXV

HOW CAMBRAY STARVED AND ENDURED

As for the rest, 'tis in the domain of history. Not only Maître Manuchet,
but Le Carpentier in his splendid History of Cambray, has told us how the
Duke of Parma's armies, demoralized by that day of disasters, took as many
weeks to recuperate and to rally as did the valiant city to recover from her
wounds.

Too late did Parma discover that he had been hoaxed, that the massed
French troops, who had terrified his armies, consisted of a handful of men,
who had been made to shout and to make much noise, so as to scare those
whom they could not have hoped to conquer in open fight. It was too late
now for the great general to retrieve his blunder; but not too late to prepare
a fresh line of action, wait for reinforcements, reorganize the forces at his
command and then to resume the siege of Cambray, with the added hope of
inflicting material punishment upon the rebel city for the humiliation which
she had caused him to endure.

The French armies were still very far away. Parma's numerous spies
soon brought him news that Monsieur Duc d'Anjou, was only now busy in
collecting and training a force which eventually might hope to vie in
strength and equipment with the invincible Spanish troops, whilst the King
of France would apparently have nothing to do with the affair and openly
disapproved of his brother's intervention in the business of the Netherlands.

The moment therefore was all in favour of the Spanish commander; but
even so he did not again try to take Cambray by storm. Many historians
have averred that a nameless superstition was holding him back, that he had
seen in the almost supernatural resistance of the city, the warning finger of
God. Be that as it may, he became, after the day of disaster, content to
invest the approaches to the French frontier, and after awhile, when his
reinforcements had arrived, he formed with his armies a girdle around
Cambray with a view to reducing her by starvation.

A less glorious victory mayhap, but a more assured one!

II

So Cambray starved and endured.

For four months her citizens waited, confident that the promised help
from France would come in the end. They had hoped and trusted on that
never-to-be-forgotten day four months ago when they covered themselves
with glory, and their trust had not been misplaced. The masked stranger
whom they had followed unto death and victory, the man who had rallied
them and cheered them, who had shown them the example of intrepid
valour and heroic self-sacrifice, had promised them help from France on
that day, and that help had come just as he had promised. Now that he was
gone from them, the burghers and the soldiers, the poor and the rich alike—
aye! even the women and the children—would have felt themselves
eternally disgraced if they had surrendered their city which he had so
magnificently defended.

So they tightened their belts and starved, and waited with stoicism and
patience for the hour of their deliverance.

And every evening when the setting sun threw a shaft of crimson light
through the stately windows of Notre Dame, and the gathering dusk drew
long shadows around the walls, the people of Cambray would meet on the
Place d'Armes inside the citadel, and pray for the return of the hero who had
fought for their liberty. Men and women with pale, gaunt faces, on which
hunger and privations had already drawn indelible lines; men and women,
some of whom had perhaps never before turned their thoughts to anything
but material cares and material pleasures, flocked now to pray beneath the
blue vault of heaven and to think of the man who had saved them from ruin
and disgrace.

Nobody believed that he was dead; though many had seen him fall, they
felt that he would return. God Himself had given Cambray her defender in
the hour of her greatest peril: God had not merely given in order to take
away again. Vague rumours were afloat that the mysterious hero was none
other than the Duc d'Anjou, own brother of the King of France, who one
day would be Sovereign Lord over all the United Provinces; but as to that,
no one cared. He who was gone was the Defender of Cambray: as such, he
was enshrined in thousands of hearts, as such he would return one day to
receive the gratitude and the love of the people who worshipped him.

III

Le Carpentier draws a kindly veil over the sufferings of the unfortunate


city. With pathetic exactitude, he tells us that a cow during the siege fetched
as much as three hundred francs—an enormous sum these days—a sheep
fifty francs, an egg forty sols and an ounce of salt eight sols; but he
altogether omits to tell us what happened to the poor people, who had
neither fifty francs nor yet forty sols to spend.

Maître Manuchet, on the other hand, assures us that at one time bread
was entirely unobtainable and that rats and mice formed a part of the daily
menu of the rich. He is more crude in his statements than Le Carpentier, and
even lifts for our discreet gaze just one corner of that veil, wherewith
history has chosen to conceal for ever the anguish of a suffering city. He
shows us three distinct pictures, only sketched in in mere outline, but with
boldness and an obvious regard for truth.

One of these pictures is of Jacqueline de Broyart, the wealthy heiress


who shared with the departed hero the worship of the citizens of Cambray.
Manuchet speaks of her as of an angel of charity, healing and soothing with
words and hands and heart, as of a vision of paradise in the midst of a
torturing hell—her courage and endurance a prop for drooping spirits; her
voice a sweet, insistent sound above the cries of pain, the curses and the
groans. Wide-eyed and pale, but with a cheering smile upon her lips, she
flits through the deserted streets of Cambray, bringing the solace of her
presence, the help that can be given, the food that can be shared, to many a
suffering home.

Of the man who hath possession of her heart, she never speaks with
those in authority; but when in a humble home there is talk of the hero who
has gone and of his probable return, she listens in silence, and when
conjectures fly around her as to his identity, she even tries to smile. But in
her heart she knows that her knight—the man whom the people worship—
will never come back. France will send troops and aid and protection anon;
a puissant Prince will enter Cambray mayhap at the head of his troops and
be acclaimed as the saviour of Cambray. She would no doubt in the fullness
of time plight her troth to that man, and the people would be told that this
was indeed the Duc d'Anjou et d'Alençon, who had once before stood upon
the ramparts of Cambray and shouted his defiant cry: 'À moi, citizens; and
let the body of each one of you here be a living rampart for the defence of
your homes!'

But she would know that the man who spoke those inspiring words had
gone from her for ever. Who he was, where he came from, what had
brought him to Cambray under a disguise and an assumed name, she would
perhaps never know. Nor did she care. He was the man she loved: the man
whose passionate ardour had thrilled her to the soul, whose touch had been
as magic, whose voice had been perfect music set in perfect time. He was
the man she loved—her knight. Throughout that day upon the ramparts she
had seen him undaunted, intrepid, unconquered—rallying those who
quaked, cheering those who needed help, regardless of danger, devoted
even unto death. So what cared she what was his name? Whoever he was,
he was worthy of her love.

IV
The second picture which the historian shows us is more dispiriting and
more grim. It is a picture of Cambray in the last days of July. The Spanish
armies have invested the city completely for over eight weeks, and
Cambray has been thrown entirely on her own resources and the activities
of a few bold spirits for the barest necessities of life. Starvation—grim and
unrelenting—is taking her toll of the exhausted population; disease begins
to haunt the abodes of squalor and of misery.

France has promised aid and France still tarries.

Mayhap France has forgotten long ago.

In Cambray now a vast silence reigns—the silence of impending doom.


The streets are deserted during the day, the church bells are silent. Only at
evening, in the gloom, weird and melancholy sounds fill the air, groans and
husky voices, and at times the wild shriek of some demented brain.

Cambray has fought for her liberty; now she is enduring for it—and
enduring it with a fortitude and determination, which is one Of the most
glorious entries in the book of the recording angel. Every morning at dawn
the heralds of the Spanish commander mount the redoubt on the Bapaume
road, and with a loud flourish of brass trumpets they demand in the name of
His Majesty the King of Spain the surrender of the rebel city. And every
day the summons is answered by a grim and defiant silence. After which,
Cambray settles down to another day of suffering.

The city fathers have worked wonders in organization. From the first, the
distribution of accumulated provisions has been systematic and rigidly fair.
But those distributions, from being scanty have become wholly insufficient,
and lives that before flickered feebly, have gone out altogether, while others
continue a mere struggle for existence, which would be degrading were its
object not so sublime.

Cambray will not surrender! She would sooner starve and rot and be
consumed by fire, but with her integrity whole, her courage undoubted, the
honour of her women unsullied. Disease may haunt her streets, famine
knock at every door; but at least while her citizens have one spark of life
left in their bodies, while their emaciated hands have a vestige of power
wherewith to grasp a musket, no Spanish soldier shall defile her pavements,
no Spanish commander work his tyrannical will with her.

Cambray will not surrender! She believes in her defender and her
saviour!—in his words that France will presently come with invincible
might and powerful armies, when all her sufferings will be turned to relief
and to joy. And every evening when lights are put out and darkness settles
down upon the stricken city, wrapping under her beneficent mantle all the
misery, the terrors and the heroism, men and women lay themselves down
to their broken rest with a last murmur of hope, a last invocation to God for
the return of the hero in whom lies their trust.

And in the Town Hall the city fathers sit in Council, with Messire de
Balagny there, and Monseigneur d'Inchy presiding. They, too, appear
grimly resolved to endure and to hold out; the fire of patriotism and of
enthusiasm burns in their hearts, as it does in the heart of every burgher,
noble or churl in the city. But, side by side with enthusiasm, stalks the grim
shadow of prescience—knowledge of the resources which go, diminishing
bit by bit, until the inevitable hour when hands and mouths will still be
stretched out for food and there will be nothing left to give.

Even now, it is less than bare subsistence which can be doled out day by
day; and in more than one face assembled this day around the Council
Board, there is limned the grim line of nascent despair.

It is only d'Inchy who has not lost one particle of his faith, one particle
of self-confidence and of belief in ultimate triumph.

'If ye begin to doubt,' he exclaims with tragic directness, 'how will ye


infuse trust in the hearts of your people?'

The Chief Magistrate shakes his head; the Provosts are silent. More than
one man wipes a surreptitious tear.
'We must give the people something to hearten them,' has been the
persistent call from those in authority.

De Balagny interposes:

'Our spies have succeeded in evading the Spanish lines more than once.
One of them returned yesterday from La Fère. He says the Duc d'Anjou is
wellnigh ready. The next month should see the end of our miseries.'

'A month!' sighs the Chief Magistrate. 'The people cannot hold out
another month. They are on the verge of despair.'

'They begin to murmur,' adds one of the Provosts glumly.

'And some demand that we surrender the city,' concludes de Lalain.

'Surrender the city!' exclaimed d'Inchy vehemently. 'Never!'

'Then can Monseigneur suggest something?' riposts the Chief Magistrate


dryly, 'that will restore confidence to a starving population?'

'The help from France almost within sight,' urges Monseigneur.

The Provosts shrug their shoulders.

'So long delayed,' one of them says. 'The people have ceased to believe
in it.'

'Many declare the Duke is dead,' urges another.

'But ye know better than that, Messires,' retorts d'Inchy sternly.

Again one or two of the older men shrug their shoulders.

'I saw him fall from the ramparts,' asserts one.

'He was struck full in the breast by an arrow,' says another, 'shot by an
unseen hand—some abominable assassin. His Highness gave one turn and
fell into the moat below.'
'And was immediately found and picked up by some of my men,' retorts
de Balagny hotly. 'Mine oath on it! Our spies have seen him—spoken with
him. The Duc d'Anjou is alive and on his way to Cambray. I'd stake on it
the salvation of my soul!'

The others sigh, some of them dubiously, others with renewed hope.
From their talk we gather that not one of them has any doubt in his mind as
to the identity of the brave defender of Cambray. Nothing had in truth
happened to shake their faith in him, and de Balagny had said nothing to
shake that faith. On that fateful day in April they had been convened to
witness the betrothal of Madame Jacqueline de Broyart to Monsieur Duc
d'Anjou, had been presented to His Highness and kissed his hands. Then
suddenly all had been confusion—the panic, the surprise attack, the
runaway soldiers, and finally the one man who rallied every quaking spirit
and defended the city with heart and mind, with counsel and strength of
arm, until he fell by an unseen assassin's hand: he, the Duc d'Anjou, of the
princely House of France—the future Sovereign Lord of a United
Netherlands.

For awhile there is absolute stillness in the Council room. No one


speaks; hardly does any one stir. Only the massive clock over the
monumental hearth ticks out every succeeding second with relentless
monotony. Monseigneur is buried in thought. The others wait, respectfully
silent. Then suddenly d'Inchy looks up and gazes determinedly on the faces
round him.

'Madame Jacqueline must help us,' he says firmly.

'Madame Jacqueline?' the Chief Magistrate exclaims. 'How?'

'On the Place d'Armes—one evening—during the intercession,'


Monseigneur goes on, speaking rapidly and with unhesitating resolve. 'She
will make a solemn declaration before the assembled people—plight her
troth to the Duc d'Anjou, who, though still absent, has sent her a token of
his immediate arrival.'

'Sent her a token?' most of them murmur, astonished. And even de


Balagny frowns in puzzlement.

You might also like