Full Learning IPython For Interactive Computing and Data Visualization - Second Edition Cyrille Rossant Ebook All Chapters
Full Learning IPython For Interactive Computing and Data Visualization - Second Edition Cyrille Rossant Ebook All Chapters
com
https://textbookfull.com/product/learning-ipython-
for-interactive-computing-and-data-visualization-
second-edition-cyrille-rossant/
https://textbookfull.com/product/interactive-data-visualization-for-
the-web-murray/
textbookfull.com
https://textbookfull.com/product/interactive-data-visualization-for-
the-web-an-introduction-to-designing-with-d3-1st-edition-murray/
textbookfull.com
https://textbookfull.com/product/python-for-data-analysis-data-
wrangling-with-pandas-numpy-and-ipython-wes-mckinney/
textbookfull.com
https://textbookfull.com/product/lectures-on-light-nonlinear-and-
quantum-optics-using-the-density-matrix-2nd-edition-rand/
textbookfull.com
Love Canal : a toxic history from Colonial times to the
present 1st Edition Newman
https://textbookfull.com/product/love-canal-a-toxic-history-from-
colonial-times-to-the-present-1st-edition-newman/
textbookfull.com
https://textbookfull.com/product/the-routledge-handbook-of-mass-media-
ethics-2nd-edition-lee-wilkins/
textbookfull.com
https://textbookfull.com/product/geothermics-heat-flow-in-the-
lithosphere-2nd-edition-vincenzo-pasquale/
textbookfull.com
Cyrille Rossant
BIRMINGHAM - MUMBAI
Learning IPython for Interactive Computing
and Data Visualization
Second Edition
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book
is sold without warranty, either express or implied. Neither the author nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78398-698-9
www.packtpub.com
Credits
Reviewers Proofreader
Damián Avila Safis Editing
Nicola Rainiero
G Scott Stukey Indexer
Monica Ajmera Mehta
Commissioning Editor
Kartikey Pandey Production Coordinator
Conidon Miranda
Acquisition Editors
Kartikey Pandey Cover Work
Conidon Miranda
Richard Brookes-Bland
Technical Editor
Pranil Pathare
Copy Editor
Stephen Copestake
About the Author
In the open source area, he is a core developer for several interesting and popular
projects, such as IPython/Jupyter, Bokeh, and Nikola. He has also started his own
projects, being RISE, an extension to enable amazing live slides in the Jupyter
notebook, the most popular one. He has also written several tutorials about
the Scientific Python tools (available at Github) and presented several talks
at international conferences.
He has an ambition to simplify his work with open software and use and develop
new ones; sometimes obtaining good results, at other times, negative. You can reach
Nicola on his website at http://rainnic.altervista.org.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub
files available? You can upgrade to the eBook version at www.PacktPub.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
[email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for
a range of free newsletters and receive exclusive discounts and offers on Packt books and
eBooks.
TM
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
[i]
Table of Contents
[ ii ]
Table of Contents
Manipulating data 69
Selecting data 69
Selecting columns 70
Selecting rows 70
Filtering with boolean indexing 72
Computing with numbers 73
Working with text 75
Working with dates and times 76
Handling missing data 77
Complex operations 78
Group-by 78
Joins 80
Summary 83
Chapter 3: Numerical Computing with NumPy 85
A primer to vector computing 85
Multidimensional arrays 86
The ndarray 86
Vector operations on ndarrays 87
How fast are vector computations in NumPy? 88
How an ndarray is stored in memory 89
Why operations on ndarrays are fast 91
Creating and loading arrays 91
Creating arrays 91
Loading arrays from files 93
Basic array manipulations 94
Computing with NumPy arrays 97
Selection and indexing 98
Boolean operations on arrays 99
Mathematical operations on arrays 100
A density map with NumPy 103
Other topics 107
Summary 108
Chapter 4: Interactive Plotting and Graphical Interfaces 109
Choosing a plotting backend 109
Inline plots 109
Exported figures 111
GUI toolkits 111
Dynamic inline plots 113
Web-based visualization 114
[ iii ]
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Table of Contents
[ iv ]
Table of Contents
[v]
Preface
Data analysis skills are now essential in scientific research, engineering, finance,
economics, journalism, and many other domains. With its high accessibility and
vibrant ecosystem, Python is one of the most appreciated open source languages for
data science.
The first edition of Learning IPython for Interactive Computing and Data Visualization
was published in April 2013, several months before the release of IPython 1.0. This
new edition targets IPython 4.0, released in August 2015. In addition to reflecting the
novelties of this new version of IPython, the present book is also more accessible to
non-programmer beginners. The first chapter contains a brand new crash course on
Python programming, as well as detailed installation instructions.
Since the first edition of this book, IPython's popularity has grown significantly,
with an estimated user base of several millions of people and ongoing collaborations
with large companies like Microsoft, Google, IBM, and others. The project itself has
been subject to important changes, with a refactoring into a language-independent
interface called the Jupyter Notebook, and a set of backend kernels in various
languages. The Notebook is no longer reserved to Python; it can now also be used
with R, Julia, Ruby, Haskell, and many more languages (50 at the time of this
writing!).
[ vii ]
Preface
The Jupyter project has received significant funding in 2015 from the Leona M. and
Harry B. Helmsley Charitable Trust, the Gordon and Betty Moore Foundation, and
the Alfred P. Sloan Foundation, which will allow the developers to focus on the
growth and maturity of the project in the years to come.
Chapter 3, Numerical Computing with NumPy, details how to use NumPy for efficient
computing on multidimensional numerical arrays.
Chapter 6, Customizing IPython, shows how IPython and the Jupyter Notebook can be
extended for customized use-cases.
[ viii ]
Preface
Since our world is becoming more and more data-driven, knowing how to analyze
data effectively is an essential skill to learn. If you're used to spreadsheet programs
like Microsoft Excel, you will appreciate Python for its much larger range of analysis
and visualization possibilities. Knowing this general-purpose language will also let
you share your data and analysis with other programs and libraries.
Conventions
In this book, you will find a number of text styles that distinguish between different
kinds of information. Here are some examples of these styles and an explanation of
their meaning.
Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
"Run it with a command like bash Anaconda3-2.3.0-Linux-x86_64.sh (if
necessary, replace the filename by the one you downloaded)."
[ ix ]
Preface
New terms and important words are shown in bold. Words that you see on the
screen, for example, in menus or dialog boxes, appear in the text like this: "To create
a new notebook, click on the New button, and select Notebook (Python 3)."
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it helps
us develop titles that you will really get the most out of.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.
You can also report any issues at https://github.com/ipython-books/minibook-
2nd-code/issues.
[x]
Preface
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you could report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our website or added
to any list of existing errata under the Errata section of that title.
[ xi ]
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
We appreciate your help in protecting our authors and our ability to bring you
valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at
[email protected], and we will do our best to address the problem.
Getting Started with IPython
In this chapter, we will cover the following topics:
In the past few years, Python has also emerged as one of the leading open
platforms for data science and high-performance numerical computing. This might
seem surprising as Python was not originally designed for scientific computing.
Python's interpreted nature makes it much slower than lower-level languages like
C or Fortran, which are more amenable to number crunching and the efficient
implementation of complex mathematical algorithms.
However, the performance of these low-level languages comes at a cost: they are
hard to use and they require advanced knowledge of how computers work. In the
late 1990s, several scientists began investigating the possibility of using Python for
numerical computing by interoperating it with mainstream C/Fortran scientific
libraries. This would bring together the ease-of-use of Python with the performance
of C/Fortran: the dream of any scientist!
[1]
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Getting Started with IPython
Consequently, the past 15 years have seen the development of widely-used libraries
such as NumPy (providing a practical array data structure), SciPy (scientific
computing), matplotlib (graphical plotting), pandas (data analysis and statistics),
scikit-learn (machine learning), SymPy (symbolic computing), and Jupyter/IPython
(efficient interfaces for interactive computing). Python, along with this set of
libraries, is sometimes referred to as the SciPy stack or PyData platform.
Competing platforms
Python has several competitors. For example, MATLAB (by Mathworks)
is a commercial software focusing on numerical computing that is
widely-used in scientific research and engineering. SPSS (by IBM) is a
commercial software for statistical analysis. Python, however, is free and
open source, and that's one of its greatest strengths. Alternative open
source platforms include R (specialized in statistics) and Julia (a young
language for high-performance numerical computing).
This book provides a solid introduction to the whole platform by focusing on one
of its main components: Jupyter/IPython.
[2]
Chapter 1
Example of a notebook
It quickly became clear that this interface could be used with languages other than
Python such as R, Julia, Lua, Ruby, and many others. Further, the Notebook is not
restricted to scientific computing: it can be used for academic courses, software
documentation, or book writing thanks to conversion tools targeting Markdown,
HTML, PDF, ODT, and many other formats. Therefore, the IPython developers
decided in 2014 to acknowledge the general-purpose nature of the Notebook by
giving a new name to the project: Jupyter.
[3]
Getting Started with IPython
In August 2015, the IPython/Jupyter developers achieved the "Big Split" by splitting
the previous monolithic IPython codebase into a set of smaller projects, including
the language-independent Jupyter Notebook (see https://blog.jupyter.
org/2015/08/12/first-release-of-jupyter/). For example, the parallel
computing features of IPython are now implemented in a standalone Python
package named ipyparallel, the IPython widgets are implemented in ipywidgets,
and so on. This separation makes the code of the project more modular and facilitates
third-party contributions. IPython itself is now a much smaller project than before
since it only features the interactive Python terminal and the Python kernel for the
Jupyter Notebook.
This book gives you a solid introduction to Jupyter and the SciPy
platform. The IPython Interactive Computing and Visualization Cookbook
(http://ipython-books.github.io/cookbook/) is the sequel of
this introductory-level book. In 15 chapters and more than 500 pages,
it contains a hundred recipes covering a wide range of interactive
numerical computing techniques and data science topics. The IPython
Cookbook is an excellent addition to the present IPython minibook if
you're interested in delving into the platform in much greater detail.
[4]
Chapter 1
References
Here are a few references about IPython and the Notebook:
Anaconda comes with a package manager named conda, which lets you manage
your Python distribution and install new packages.
Miniconda
Miniconda (http://conda.pydata.org/miniconda.html) is
a light version of Anaconda that gives you the ability to only install
the packages you need.
[5]
Getting Started with IPython
Downloading Anaconda
The first step is to download Anaconda from Continuum Analytics' website
(http://continuum.io/downloads). This is actually not the easiest part since
several versions are available. Three properties define a particular version:
• The operating system (OS): Linux, Mac OS X, or Windows. This will depend
on the computer you want to install Python on.
• 32-bit or 64-bit: You want the 64-bit version, unless you're on an old or low-
end computer. The 64-bit version will allow you to manipulate large datasets.
• The version of Python: 2.7, or 3.4 (or later). In this book, we will use
Python 3.4. You can also use Python 3.5 (released in September 2015)
which introduces many features, including a new @ operator for matrix
multiplication. However, it is easy to temporarily switch to a Python 2.7
environment with Anaconda if necessary (see the next section).
Once you have found the right link for your OS and Python 3 64-bit, you can
download the package. You should then find it in your downloads directory
(depending on your OS and your browser's settings).
Installing Anaconda
The Anaconda installer comes in different flavors depending on your OS, as follows:
• Linux: The Linux installer is a bash .sh script. Run it with a command
like bash Anaconda3-2.3.0-Linux-x86_64.sh (if necessary, replace the
filename by the one you downloaded).
• Mac: The Mac graphical installer is a .pkg file that you can run with a
double-click.
• Windows: The Windows graphical installer is an .exe file that you can run
with a double-click.
[6]
Random documents with unrelated
content Scribd suggests to you:
happiest are the common folk who toil
ield by day, eat scanty fare, and sleep
night unvex’d by cares of state or plots
traitorous nobles envious of a crown.
Fool. What do I say of kings? Marry, I say they were best to
watch well their daughters and their kingdoms; it needs no fool to
say so much as that. Prithee, art thou a king of the same mould as
these thou beholdest here in this place?
King Henry. At scarce nine months was I anointed king.
Fool. Truly, thou serv’st a tender apprenticeship to thy business
and I marvel the less at thy present having. [To Lear] Good nuncle,
here’s yet another king out at the elbows, one, belike, that shook his
rattle as ’t were a sceptre, and wore his porringer on ’s head where
his crown should have been.
Lear [to King Henry] And thou, too, wert a king?
King Henry. I was, but now
m I a king no longer. Edward of March
surps my title and my crown. There come
o suitors unto me, a shadow prince
ated with Madge of Anjou, strong where I
m weak, for she loves war, and weak where I
m strong, for I am joined to content
hich she, poor soul, wots little of.
King Richard. O let
s make a compact with this same content;
which shall joy the most in it, that thus
he hours shall fleet unhinder’d o’er our heads
o’er the shepherd’s gazing on his flock
om out the hawthorn shade. Or what say you,
ere it not fitter pastime to bewail
ur loss of crown and kingdom morn by morn,
ening by evening, till at last we died
grief?
King Henry. Wiser it were to strive to find
hat comfort’s left to us.
King Richard. Why, so we will.
ome, fool, be thou our numbering clock and tell
em by item all that’s left to us
nhappy kings, brothers in wretchedness.
Lear. A plague upon ye both that will not curse
he authors of your woes, that will not vex
he heavens with prayers for their undoing. Curse
n curse I’ll heap upon the heads of those
e wolves, my daughters, sprung from out my loins;
he kingdom’s ruin and their father’s bane.
[Exit raving.
Fool. Farewell to you both, for I must after him that’s such an
eager spendthrift of his curses, and may each of you come upon a
kingdom to your mind—when the sun shall smite in January.
[Exit Fool.
King Henry. A more than common grief look’d from his eye
hat roll’d so wildly in his head; pray God
e keep our wits, whatever else be lost
us.
King Richard. And I might see proud Bolingbroke
such a case as his that parted now,
deem that I could die full willingly.
King Henry. Would I were dead, an’ it were God’s good will;
ut whilst I live I ne’er will còntrive aught
evil ’gainst mine enemy, nor wish
m ill, for so weighs woe the heavier
n him invoking. Our good captain Christ
d bid us to the smiter turn the cheek
hat’s smitten yet again, nor harm him not
r all the mischiefs he doth put on us.
[Soft music heard.
King Richard. How softly steals sweet music on the soul,
utting its doors to misery and pain,
osing the senses ’gainst all foes without,
rning the hard couch unto airy down,
ssolving time in melting harmonies.
I could list forever to its sound,
ut it, or something stronger, masters me.
[Sleeps.
King Henry. Poor, changeful-hearted man that wast a king,
d captive by each wayward quick caprice,
nhappy fate call’d thee unto a throne
it did me; our kingdoms suffer’d for’t.
joy thy sleep by music underpropt,
l waking show thee as thou wert before,
crownless monarch weeping for thy crown.
[Exit King Henry.
Miranda. My heart is full of pity for these kings
anting their crowns.
Ferdinand. Those crowns had still been worn
ad they known truly what it is to be
king. O, my Miranda, only such
hat are compos’d of strength and gentleness
fair proportion mix’d, should e’er essay
he sceptre. He that may not rule himself
of all monarchs least significant.
[Exeunt.
Scene VI.
A glade in another part of the island with Ferdinand and Miranda
observed seated at the upper end thereof. Nearer at hand a group
of Athenian citizens. Enter Bottom, wearing an ass’s head.
Bottom. Masters, you will marvel to behold me here, but the very
truth of the matter is that I did fall asleep, and being asleep I did
dream, and as I did lie a-dreaming I was in a manner translated to
this place, which methinks is an island, for I did espy much water
anear as I was brought hither. But, masters, I do marvel much to
look upon you here also.
Francis Flute. Methinks, friend Bottom, you are not the sole wight
in Athens esteemed worthy translation.
Robin Starveling. How an’ we be not translated either?
Peter Quince. Robin Starveling speaks well and to the centre of the
matter. Know then, good bully Bottom, we are translated as yourself,
but methinks you have lost more in the translating than have we; is’t
not e’en so, masters all?
All. Right, good Peter Quince.
Bottom. I have lost nothing that should cause you envy, good
friends all, and so I assure you. [Brays loudly] What say you then to
my voice? Is my voice perished?
Tom Snout. No, Nick Bottom.
Bottom. I thank you, good Tom Snout, and to show you that I am
the same Nick Bottom, however my visage may appear altered, for
travel doth greatly age a man, as they say, you shall hear me wake
the echoes once again.
[Brays a second time, more loudly.
Quince. Methinks your voice, good Bottom, has lost somewhat of
sweetness.
Bottom. That’s all one, good Peter Quince, for the simple truth of
the matter is that you have no such delicate ear for fine harmonies
as I am endow’d with.
[Strokes his ears.
Quince. It doth seem so on more properer consideration, and I
had an ear that were the parallax of yours ’twere pity of my life.
All. Indeed, an’ ’twere but pity of your life, Peter Quince.
Bottom. How say you, masters, shall not we spread ourselves? [All
sit down.
Miranda. O Ferdinand, be these all mortal like
urselves? More surely I did never spy
o hideously strange a being such
he who hath the ass’s head.
Ferdinand. Nor I.
elike he hath incurr’d some wizard’s spite
nd, all unwitting, wears this semblance till
he wizard’s anger shall be spent. But see,
s fellows play upon his ignorance
nd of his strange beguilement make their sport.
Bottom. Since it is conceded by all of you that I have lost nothing
by translation, doth it not follow, moreover, that I have somewhat
gained by that same adventure?
Flute. In good truth you have gained by somewhat, Nick Bottom.
Bottom. I were an ass, indeed, an’ I had not.
Snug. And twice an ass, moreover, should he be that would go
about to steal it from you.
Bottom. Methinks that I could munch a savoury salad of thistles
with much stomach to’t.
Quince. Your thistles be a thought too biting for my stomach.
Bottom. ’Tis but likely. I was ever a choice feeder. But, masters,
was there not some matter toward, or have you assembled
yourselves but to greet me, and, as ’twere, fittingly?
Quince. You speak quite to the matter, good Bottom. That is
indeed the true end of our beginning. To behold your winsome
visage in this unwonted place is great joy to us simple mechanicals,
yet we be nevertheless bold to proclaim to you that to shave were
not amiss to one of your condition. For but bethink you, and you
were to come amongst ladies thus grievously beset with hair would
shame us all.
Snug. Mayhap in this strange part of the world ’twould be thought
matter for a hanging, and that were, indeed, a most serious
business, to my thinking.
Quince. But an’ we talk of ladies and hangings, moreover, hither
comes a monstrous little lady, as ’twere on the instant.
Enter Titania, with her train.
Titania. Where stays the gentle mortal I adore,
hose voice unto mine ear makes harmonies
elestial, and whose amiable face
thralls my heart in loving servitude?
Peaseblossom. Yonder he bides.
Moth. ’Mong others of his kind.
Cobweb. Alike, yet different.
Mustardseed. Chief mortal seen.
Titania [espying Bottom] What angel can compare unto my love?
eauty itself, beholding thee, might swoon
r envy, and the eldest sage would yield
s place to thee on th’ instant. O my love!
[Winds her arms about his neck.
hou shalt dwell with me ever. Oberon
thee is but a gaping pig, and thou
him the nonpareil of beauteous youth.
Bottom. Good mistress atomy, though you show somewhat spare
of flesh you are yet of a right comely countenance (and mine eyes
do tell me aught without spectacles), and you can speak to the point
upon occasion, as the present moment doth signify most
auspiciously.
Titania. O I could list unto thy silver tongue
l Time itself wax’d eld and perished.
Bottom. How say you, masters? Hath not mistress atomy a shrewd
manner of observation an’ she singles me out from the company of
my fellows thus compellingly?
Quince. O bully Bottom, you are, as I take it, the simple wonder of
our age.
All. Right, master Quince. Nick Bottom is become a very marvel.
Titania. Fain would I hear thy heavenly note again.
ng, wondrous mortal, while I link mine arms
bout thy peerless form, or garlands twine
dewy flowers to hang about thy neck,
hat neck, of all necks most incomparable.
Bottom [sings]
Upon the hay
Cophetua
Did waste the hours in sighing.
The beggar maid
Unto him said,
Good sir, are you a dying?
Titania. That voice would make the nightingale asham’d. [Kisses him
ow must thou leave thy fellows in this place
nd speed along with me unto my court,
here we’ll abide in loving dalliance
ntil thy mortal part’s with spirit mix’d.
aseblossom! Cobweb! Moth! and Mustardseed!
Peaseblossom. Ready.
Cobweb. And I.
Moth. And I.
Mustardseed. And I.
All. Your hest,
ur queen, is still our duty and delight.
Titania. Attend us to the court, and evermore
ve special heed unto this gentleman,
nticipate his ev’ry wish and feed
m with the choicest cates the isle doth yield.
[Exeunt Titania and Bottom, attended by train.
Quince. Were this but told in Athens, now, ’twere not believed by
aught, but we accredited liars all of the first water, and so esteemed.
All. ’Twere indeed but so, and truly, Peter Quince.
Quince. Therefore I hold that (an’ we once more come by our own
firesides in Athens), we were best make no words of the happenings
we have beheld but now, lest we be cried upon in the public streets
as those that be counted no true men.
All. That were to shame us, every mother’s son.
Quince. Why you speak the very gizzard of the matter, my masters
all, and we will be silent in such wise as I did perpetuate, and as for
Nick Bottom, let his goblin mistress do with him as she listeth, for
methinks we are well rid of his company, being, for ourselves,
nothing loose-minded but sober, virtuous citizens all.
All. That are we, Peter Quince, and we thank God for’t.
Enter Puck, unperceived, who tweaks Quince
violently by the nose and exits.
Quince. O masters, which of you—
Is suddenly twitched aside by Puck. Re-enters
with a lion’s head on his shoulders.
All. God defends us, Peter Quince.
Quince. Masters, it ill becomes you as sober citizens of Athens to
treat one of yourselves thus unseemly. Am not I a simple workman
like the rest of you? Is it not my very own voice that you hear but
now? [Roars.
All. God for his mercy.
[Exeunt all but Quince.
Quince. These be strange manners; an’ I were a very lion, though
being of a truth of a most lamblike perdition, they could not have
fled from me with greater speeding. I will e’en after them to taste
the reason of their knavery.
Enter Puck.
Puck. Now will I set these patches by the ears,
aking such monsters of their simple selves
severally shall fright them when they see
ch in the other’s fearful eyeball glass’d.
[Exit Puck.
Re-enter Quince.
Quince. And I can spy but one of my neighbours in this
predestinated place I’ll be hanged.
Re-enter Starveling, with an owl’s head.
Quince. Bless us, Robin Starveling, what wizardry do I spy in you?
Starveling. Wizardry, an’ you call it, Peter Quince? Look to your
own head an’ you would find out wizardry. There’s naught strange in
me.
Re-enter Snug, with a bear’s head.
Quince and Starveling. Save us, good Snug, how art thou
transmogrified!
Snug. Not so, neither, neighbours both. I am but Snug the joiner,
as you might behold him of any working day, but you twain,
methinks, are most marvellously encountered.
Quince and Starveling. Speak for yourself, Master Snug: we are the
same as you have known us ever.
Quince. That is, I am the same, but Master Starveling is quite
other than the simple man he was.
Starveling. Thou liest, Peter Quince. I am but plain Robin
Starveling, but you are become a very monster.
Re-enter Snout, with a deer’s head and horns.
Quince. Good masters three, you are enchanted, and pity o’ my
life it is. ’Tis I alone that doth remain as much mankind as I was
ever.
Snout. An’ you count yourself the proper likeness of a man you
are most horribly mistook, and so it is, Peter Quince.
Re-enter Flute, with the head of a crocodile.
Flute. O neighbours all, what behold I here? What sorcerer has
thus exorcised upon you? O could you be spy upon yourselves to
know how unlike you are to plain citizens like me.
Quince. A plain man, say you. Forsooth, yours is a very fearful
manner of plainness, Francis Flute. But look at me, masters all, and
you would gaze upon a plain man.
Starveling. Nay, look on me, in his stead.
Snout. Not so, but on me.
Snug. These be liars, every mother’s son. Look upon me, I say,
Francis Flute.
Flute. Masters, hear but the simple truth. You are all of you
deceived and have suffered most horrible enchantment, every
mother’s son of you but me. Heaven help you, neighbours, and undo
the spell that each and every one may become as I am.
[Gnashes his jaws fearfully.
All. That were most dire affliction of any that be in the varsal
world, Francis Flute.
Flute. And you were not something other than simple mankind I
could try conclusions with you that speak thus enviously. Indeed, I
am something that way toward, but now.
[Exeunt Omnes, fighting.
Enter Puck.
Puck. Thus have I put the simple senses all
these rude knaves sorely distraught, for each
oth fear the other, deeming him the prey
dark enchantment, while himself believes
mself none other than he was at first
Scene VII.
Enter Prospero.
Prospero. Now have I ’complish’d that I did intend,—
spers’d Miranda’s sadness utterly,
nd, for a brief space, made the airy dreams
Master Shakescene take on form again
erst in other lands and climes, that so
hese married lovers might be entertain’d
ll pleasingly, and gather from the hours
pent in this isle of summer, honey’d sweets
r fond remembrance in the tide of time.
y Ariel! What, Ariel, I say! [Enter Ariel.
hanks, gentle Ariel, who hast again
one all my bidding. But for thee my art
ad halted ere its best. Once more receive
y thanks, who am much bound to thee.
Ariel. This
time,
ood master Prospero, I serv’d for love
ot duty, and I count your thanks reward
fullest measure. And there be nothing else
u would of me, then, Prospero, adieu.
ospero. Adieu, gentlest of spirits, Ariel.
[Exit Ariel.
Thunder heard and Prospero vanishes.
Scene VIII.
ACT SIXTH
THE MERCHANT OF VENICE:
ACT SIXTH
Scene I.
Venice. A street.
Enter Shylock, followed by a rabble of shouting citizens.
First Citizen. Shylock, how speeds thy business at the court?
here is the pound of flesh thou covetest?
Second Citizen. How likest thou the judge from Padua?
Third Citizen. Eh, Jew, an upright judge! thou hast my lord
he duke to thank for thy poor life. Had I
ut been thy judge a halter had been thine,
nd thou had’st swung in’t, yet, beshrew my life,
were pity that good Christian hemp were stretch’d
hang a misbegotten knave like thee.
Fourth Citizen. Shylock, thou infidel, thou should’st have had
he lash on thine old back ten score of times
e they had suffer’d thee from out the court.
Fifth Citizen. A beating shall he have, e’en now, the knave.
[Beats Shylock.
Shylock [striking about him angrily] Aye! kill me, dogs of Christians,
an’ ye will!
eseems the Jew hath no more leave to tread
he stones on Christian streets; he may not breathe
he air a Christian breathes, nor gaze uncheck’d
pon the Christian’s sky; he hath no part
lot in anything that is, unless
Christian please to nod the head. I hate
, brood of Satan that ye are! May all
he plagues of Egypt fall upon ye, dogs
Christians; all the pains—
Fourth Citizen. Nay, gentle Jew,
s said thou must become a Christian, straight;
d Shylock, turn perforce, a “Christian dog!”
ow, greybeard infidel, how lik’st thou this?
Shylock. Eternal torments blister him that asks.
[Exit Shylock, raving.
Second Citizen. A sweet-fac’d Christian will our Shylock make.
would that I might be his cònfessor,
lay such swingeing penance on the knave
scarce would leave him space to sup his broth
mid the pauses of his punishment.
[Exeunt citizens, with shouts.
Scene II.
Scene III.
[Exit Shylock.
NOTE BY WILLIAM J. ROLFE, Litt.D.
It is a tribute of no slight significance to Shakespeare’s skill in the
delineation of character that we instinctively regard the personages
in his mimic world as real men and women, and are not satisfied to
think of them only as they appear on the stage. We like to follow
them after they have left the scene, and to speculate concerning
their subsequent history. The commentators on Much Ado, for
instance, are not willing to dismiss Benedick and Beatrice when the
play closes without discussing the question whether they probably
“lived happily ever after.” Some, like Mrs. Jameson and the poet
Campbell, have their misgivings about the future of the pair, fearing
that “poor Benedick” will not escape the “predestinate scratched
face” which he himself had predicted for the man who should woo
and win that “infernal Até in good apparel,” as he called her; while
others, like Verplanck, Charles Cowden-Clarke, Furnivall, and
Gervinus, believe that their married life will be of “the brightest and
sunniest.”
Some have gone back of the beginning of the plays, like Mrs.
Cowden-Clarke in her Girlhood of Shakespeare’s Heroines, and Lady
Martin (Helena Faucit) in her paper on Ophelia in Some of
Shakespeare’s Female Characters.
Others, like Mr. Adams, have made the experiment of continuing a
play of Shakespeare in dramatic form. Ernest Renan, in France, and
Mr. C. P. Cranch, in this country, have both done this in the case of
The Tempest, mainly with the view of following out the possible
adventures of Caliban after Prospero had left him to his own devices.
These and similar sequels to the plays are nowise meant as
attempts to “improve” Shakespeare (like Nahum Tate’s version of
Lear, that held the stage for a hundred and sixty years) and sundry
other perversions of the plays in the eighteenth century, which have
damned their presumptuous authors to everlasting infamy. They are
what Renan, in his preface, calls his Caliban,—“an idealist’s fancy
sketch, a simple fantasy of the imagination.”
Mr. Adams’s Sixth Act of The Merchant of Venice is an experiment
of the same kind; not, as certain captious critics have regarded it, a
foolhardy attempt to rival Shakespeare. It was originally written for
an evening entertainment of the “Old Cambridge Shakespeare
Association.” No one in that cultivated company misunderstood the
author’s aim, and all heartily enjoyed it. I believe that it will give no
less pleasure to the larger audience to whom it is now presented in
print.
Transcriber’s Note:
Words may have multiple spelling variations or inconsistent
hyphenation in the text. These have been left unchanged. Obsolete
words, alternative spellings, and misspelled words were not
corrected.
Obvious printing errors, such as backwards, reversed, upside
down, or partially printed letters and punctuation, were corrected.
Final stops missing at the end of sentences and abbreviations were
added. Duplicate words at line endings were removed. Right-aligned
stage directions were adjusted so that all are preceded by an open
bracket.
*** END OF THE PROJECT GUTENBERG EBOOK A MOTLEY JEST ***