(Ebook) Learning IPython for Interactive Computing and Data Visualization by Cyrille Rossant ISBN 9781783986989, 1783986980 download
(Ebook) Learning IPython for Interactive Computing and Data Visualization by Cyrille Rossant ISBN 9781783986989, 1783986980 download
https://ebooknice.com/product/learning-ipython-for-interactive-
computing-and-data-visualization-43206680
https://ebooknice.com/product/learning-ipython-for-interactive-computing-
and-data-visualization-second-edition-5480298
https://ebooknice.com/product/learning-ipython-for-interactive-computing-
and-data-visualization-55662116
https://ebooknice.com/product/ipython-interactive-computing-and-
visualization-cookbook-5325678
https://ebooknice.com/product/interactive-data-visualization-for-the-
web-5551862
(Ebook) Interactive Data Visualization for the Web by Murray,
Scott ISBN 9789595423166, 9789600423167, 9595423165, 9600423164
https://ebooknice.com/product/interactive-data-visualization-for-the-
web-11901598
https://ebooknice.com/product/interactive-data-visualization-for-the-web-
an-introduction-to-designing-with-d3-6769294
https://ebooknice.com/product/interactive-data-visualization-for-the-web-
an-introduction-to-designing-with-d3-55920266
https://ebooknice.com/product/interactive-data-visualization-for-the-web-
an-introduction-to-designing-with-d3-7187934
https://ebooknice.com/product/interactive-web-based-data-visualization-
with-r-plotly-and-shiny-10842110
[1]
www.allitebooks.com
Learning IPython for Interactive
Computing and Data
Visualization
Second Edition
Cyrille Rossant
BIRMINGHAM - MUMBAI
www.allitebooks.com
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
www.allitebooks.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
www.allitebooks.com
About the Author
www.allitebooks.com
About the Reviewers
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.
www.allitebooks.com
www.PacktPub.com
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
service@packtpub.com 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
www.allitebooks.com
Table of Contents
Preface vii
Chapter 1: Getting Started with IPython 1
What are Python, IPython, and Jupyter? 1
Jupyter and IPython 2
What this book covers 4
References 5
Installing Python with Anaconda 5
Downloading Anaconda 6
Installing Anaconda 6
Before you get started... 7
Opening a terminal 7
Finding your home directory 8
Manipulating your system path 8
Testing your installation 9
Managing environments 9
Common conda commands 10
References 11
Downloading the notebooks 12
Introducing the Notebook 13
Launching the IPython console 13
Launching the Jupyter Notebook 14
The Notebook dashboard 15
The Notebook user interface 16
Structure of a notebook cell 16
Markdown cells 17
Code cells 18
[i]
www.allitebooks.com
Table of Contents
[ ii ]
www.allitebooks.com
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 ]
www.allitebooks.com
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
questions@packtpub.com, 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]
Random documents with unrelated
content Scribd suggests to you:
its own intimate standard for judging what is wrong and what is
right, and when that which was wrong has now become right for it
to do.
Love, then, is Whitman’s code. And when he seeks to call the youth
of America away from selfishness and sin, he issues no new table of
Thou-Shalt-Nots, but fills their ears with the words of their destiny,
and of the meaning of America. For he knows that to sin is to
choose a narrow and despicable delight, and that one must needs
choose the nobler, larger joy when it becomes present and real.
Hence he recalls all the aspirations that went to the birth of America,
and describes the parts that women and men must fill if they are to
be realised. He reminds his young readers of all the divine
possibilities of manhood and of womanhood, and of how those
possibilities are for them; and warns them that the body must
necessarily affect the soul, for it is the medium through which the
soul comes into consciousness.
Finally, in the new poems, Whitman makes more plain his attitude
toward the woman question, as it is called. An American National
Women’s Rights Association had been founded in 1850, and
although its agitation for the suffrage proved unsuccessful, the more
general movement which it represented, especially the higher
education of women, was gaining ground throughout America. The
movement may be said to have been born in New York State, where
Mrs. Elizabeth Cady Stanton and Miss Susan B. Anthony were its
most active leaders; but it owed much to Boston also, and notably to
Margaret Fuller (Ossoli), whose tragic death had been an irreparable
loss to the cause.[227]
Whitman was in cordial sympathy with everything that could forward
the independence of women. But he disliked some outstanding
characteristics of the movement. It was in part a violent reaction
against the unwholesome sentimentalism of the past; a reaction
which took the form of sexless intellectualism with a strong bent
towards argumentation, perhaps the most abhorrent of all qualities
to Whitman.
This movement for women’s rights seemed to him too academic and
too superficial; college education and the suffrage did not appeal to
him. But he was not the less an enthusiast for the cause itself, as he
understood it. His views are simple and clear. A soul is a soul,
whether it be man’s or woman’s; and as such, it is of necessity free,
and the equal of others. A woman is every way as good as a man.
This truth must be made effective in all departments of life.
Then, taking up the thought which underlies the teaching of Plato, a
woman is a citizen; and an American woman must be as
independent, as dauntless, as greatly daring as a man. Such as the
woman essentially is, such will be the man, her son, and her mate.
But—and it is here he differs from the leaders of the movement—sex
is basic not only in society but in personal life; and the woman
unsexed is but half a woman.
Two poems in the new edition, the nucleus of the subsequent
Children of Adam, are devoted to these ideas. In the first,[228] he
describes the women of his ideal:—
Such then, added to the old, formed the contents of the new edition
of 1856. The appendix included Emerson’s letter, which Whitman
had been urged to publish, by Mr. C. A. Dana, editor of the New York
Sun, and a personal friend of Emerson.[231] He succeeded in
convincing Whitman, who appears at first to have doubted the
propriety of such an action. There is no evidence that Emerson
resented the use thus made of his glowing testimony, although he
would probably have modified his words had he written in
acknowledgment of the enlarged volume. A sentence from the letter
appeared also upon the back of the book: “I greet you at the
commencement of a great career.—R. W. Emerson.” This, together
with the storm of indignation aroused by the absolutely frank
language of the poems dealing with sex, gave the book notoriety
and a rapid sale.
It is the least pleasing of the editions of Leaves of Grass,
insignificant in appearance, and yet aggressive, by reason of that
Emersonian testimonial. The open letter at the end, of which I have
already spoken, is far from agreeable to read. It is careless,
egotistical, naïve to a degree, and crowded with exaggerations.
Addressing Emerson as master, it proceeds to denounce the
churches as one vast lie, and the actual president as a rascal and a
thief. It is so egregiously self-conscious that it makes the reader
question for a moment whether all the egoism and naïveté of the
preceding pages may not have been worn as a pose; but a
moment’s further consideration gives the question a final negative.
Few men are without their hours of weakness; and that Whitman
was not among those few, the letter is proof if such were needed.
The letter is not void of interest, since it records the rapid sale of the
previous edition of a thousand copies, and anticipates that in a few
more years the annual issue will be counted by thousands. This
sanguine forecast explains the permanent and otherwise
unreasonable disappointment of Whitman at the reception of his
book.
It still made its appearance devoid of the usual adornment of a
publisher’s name upon the title-page. Messrs. Fowler & Wells were
again the principal agents, others being arranged with in the chief
American cities, in London also, and Paris and Brussels. Plates were
cast from the type, and a large sale was prepared for. But the New
York agents soon withdrew, unwilling to face the storm of public
opinion,[232] and perhaps the dangers of prosecution, and the book
fell out of print when only a thousand copies had been issued.
The two ventures of 1855 and 1856 had brought Whitman little
money, a mere handful of serious readers, and some notoriety.
Though he did not give in, he began to look about him for some
supplementary means of delivering his soul of its burden. His
youthful success on the political platform, his love of crowds and of
personal contact, his extraordinary popularity among the younger
people, and his own keen sense of the power of oratory, turned his
thoughts to lecturing.[233] He would follow the road which Emerson
and Thoreau had taken. He would evangelise America with his
gospel. Henceforward, as his mother said, he wrote barrels of
lectures,[234] and at the same time he studied his new art more or
less systematically. After his death a package of notes on Oratory,
and the rough draft of a prospectus were found among his papers;
the latter was headed, “15 cents. Walt Whitman’s Lectures.” It
belongs to the year 1858.
By this time he had planned to write, print, distribute and recite
throughout the United States and Canada a number of lectures—
partly philosophical, partly socio-political, partly religious—with the
object of creating what he conceived to be a new, and for the first
time truly American attitude of mind. The lectures were ultimately to
form a second volume of explanation and argument which would
sustain the Leaves. He had now omitted any preface to the poems,
the creative work standing alone. But having printed the second
edition and thus relieved his mind of its most pressing burden, he
recognised that the work of explanation and of criticism remained.
Moreover, he conceived that his lectures would quicken public
interest in his book; while, by showing himself, he hoped to dispel
some of the misapprehensions which concealed his real meaning
from the popular mind. He alludes whimsically in this memorandum
to the offensive practice of self-advertisement, of which he was not
unconscious, remarking that “it cannot be helped,” for it is the only
way by which he can gain the ear of America, and bid her “Know
thyself”.
Finally, he proposed to earn his living in this manner. He would have
preferred to give his services without fee, in the Quaker fashion; but
for the time being at least, he must make a charge of ten dollars
(two guineas) a lecture, and expenses, or an admission fee of one
dime (about sixpence) a head.
The idea of lecturing was probably as old as the idea of the Leaves
of Grass; he seems to have been considering it ever since he
returned from the South. But now he formulated his ideas, which
were of course those underlying the Leaves, and thought much and
cogently on the style and manner of public speaking. His conclusions
betray an ideal for oratory as individual and as mystical as that for
the poet’s art.
Whitman, the lecturer, is conceived as a prophet possessed by the
tempestuous passion of inspiration. The orator is to combine the
gifts of the great actor with the inspiration of the Pythoness and the
spontaneity of the Quaker prophet. His gestures should be large, but
reserved; the delivery deliberate, thought-awakening, elliptical,
prophetic, wholly unlike that of the glib platform speakers of his day
and our own. At first, erect and motionless, the speaker would
impress his mere personality upon the assembly; then his eyes
would kindle, like the eyes in that strange marble Balzac of Rodin’s,
and from the eyes outward the whole body would take fire and
speak.
He conceived of oratory not as the delivery of some well-prepared
address, but as the focussing of all the powers of thought and
experience in an hour of inspiration and supreme mastery. He saw
how much it entailed—what breadth of knowledge, what depth of
thought, what perfect flexibility of voice and gesture trained to clear
suggestion, what absolute purity of body, what perfect self-control.
For, he would say to himself, the great orator is an artist as supreme
as Alboni herself; his voice is to be as potent as hers, and his life
must show an equal devotion to its purpose.
In this conception of the orator we have then a most interesting
parallel with that of the poet. And just as Whitman the poet stands
part way between the writer of prose and the singer in verse,
including in himself some of the qualities of each, and adding an
inspiration wholly his own, so Whitman the orator appears in this
vision standing between the actor-singer and the lecturer or
preacher, improvising great words.
The political aspect of his enterprise is suggested by a brief
memorandum, dated in April, 1857,[235] wherein he notes that the
“Champion of America” must keep himself clear of all official
entanglements, devoting himself solely to the maintenance of a
living interest in public questions throughout the length and breadth
of the land. Standing aside from the parties with their clamorous
cries, he must hold the public ear by nobler tones.
In another place[236] he writes that as Washington had freed the
body politic of America from its dependence upon the English crown,
so Whitman will free the American people from their dependence
upon European ideals. The mere publication of such frank, but
private assertions of Whitman’s own faith in himself, will doubtless
arouse a ready incredulity in the reader’s mind. It might, perhaps,
seem kinder to his memory to suppress them altogether; but upon
second thought it will, I think, appear possible that he was a better
judge than others of his own ability. His personality was one of
extraordinary power, and his outlook of a breadth which was almost
unique. And, as I have said, he felt himself to be an incarnation of
the American spirit.
At the time, America was without leadership. Lincoln was still
unseen; and Whitman was fully as capable of filling the highest
office in the United States as several who have held it; while nothing
in the circumstances or traditions of the White House made it absurd
for any able citizen, of whatever rank, to entertain the thought of its
tenancy. This would be especially true of a popular New Yorker, who
made perhaps the best of all candidates for a Presidential campaign.
The Republican party had but just been formed, and for the first
time had fought an election. Thunderclouds of war were in the air,
urged on by the ominous forces of slavery, and America was without
a champion.
I think the idea of political leadership crossed Whitman’s mind at this
time, and that he put it definitely aside. The hour cried out for the
man, and the cry was not to go unanswered; but with all his power
and all his goodwill and fervour, Whitman became slowly convinced
that it was not to be he. He had seen too much of party
manœuvres, and had too vigorous a love of personal liberty, to
contend for office. But he did covet the power of a prophet to stir
the heart of America, and appeal to her people everywhere in her
name. He never gave up the idea of lecturing or lost his interest in
oratory; but the lectures he planned, the course on Democracy and
the rest, remained undelivered. It is as though he had prepared
himself and stood awaiting a call which never came.
Instead, he turned once more to add new poems to his collection. A
hint in explanation is to be found in a poem written about this time,
[237] in which he tells how, having first sought knowledge, he then
determined to live for America and become her orator; he was
afterwards possessed by the desire for a heroic life of action, but
was given the commission of song. Finally, another change came
over his spirit; the claims of his own life seized him; he could not
escape from the passion of comradeship which overwhelmed him
and wholly absorbed his thought.[238] We shall consider this phase
in the next chapter, but before doing so, it will be well to recall the
political events of the hour and the circumstances surrounding the
advent of a new power and personality into American life.
FOOTNOTES:
[202] M. D. Conway, Autobiography.
[203] Fort. Rev., vi., 538; Kennedy, 51.
[204] In re, 36.
[205] See Familiar Letters of H. D. Thoreau, 339-349.
[206] F. B. Sanborn’s Thoreau, 307; cf. H. S. Salt’s Thoreau, 293.
[207] Fam. Letters, 347.
[208] Camden, lxxii.; cf. Life of A. Tennyson, ii., 424.
[209] A new translation of the great Indian classic had just
appeared.
[210] Kennedy, 78.
[211] L. of G., 112, 120.
[212] L. of G., 176.
[213] L. of G. (1860), 329; cf. An American Primer, by W. W.
(1904).
[214] L. of G., 179.
[215] L. of G., 177.
[216] Ib., 120.
[217] L. of G., 129.
[218] Ib., 207; (’60), 229-31.
[219] See also p. 166.
[220] L. of G., 285.
[221] Ib., 148.
[222] L. of G., 264.
[223] Ib. (1860), 121.
[224] L. of G. (1860), 166.
[225] Ib., 171-74; cf. L. of G., 213.
[226] L. of G. (1860), 172.
[227] See esp. the Life of Susan B. Anthony.
[228] L. of G., 88.
[229] L. of G., 90.
[230] Ib. (1856).
[231] Bucke, 139.
[232] Burroughs, 19.
[233] Camden, vii.; viii., 244-260; ix., 200; x., 32.
[234] In re, 35.
[235] Camden, ix., 7, 8.
[236] Ib., viii., 245.
[237] L. of G. (1860), 354.
[238] As the poem is not given in the complete L. of G. I reprint it
here:—
Abraham Lincoln, the man for whom the hour cried out, was not
quite unknown to fame.[239] Ten years older than Whitman, and like
Whitman owning to a strain of Quaker blood in his veins, he
belonged by origin to the South and by adoption to the West. After
six years’ service in the Illinois Legislature, and a term in the Lower
House at Washington, he settled down at the age of forty to his
profession as a country lawyer.
In 1854 the repeal of the Missouri compromise in favour of “squatter
sovereignty” recalled him to political life, and he became the
champion of Free-soil principles in his State, against the chief
sponsor of the opposing doctrine, the “little giant of Illinois,” Judge
Stephen Douglas. His reply to Douglas in October of that year was
read and applauded by his party throughout America.
Hitherto he had been a Whig, and during Clay’s lifetime, his devoted
follower, but the repeal of the compromise was followed in 1856 by
the formation of a new party, and Lincoln and Whitman both became
“black republicans”. “Barnburners,” Abolitionists and “Anti-Nebraska”
men—those that is to say who opposed the application of the
doctrine of “squatter sovereignty” to Nebraska and Kansas—had
united to form a new Free-soil party. They nominated J. C. Frémont,
the gallant Californian “Path-finder” for the Presidency; but, owing to
the presence of a third candidate put forward by the Know-nothing
Whigs—whose only policy seems to have been a “patriotic” hatred of
all Catholics and foreigners—the Democratic nominee was elected
for the last time in a generation. After his four years were out, a
succession of Republican Presidents occupied the White House for
twenty-four years.
James Buchanan, who defeated Frémont—becoming like Lincoln, his
successor, a minority President—seems to have been an honourable
and well-intentioned Pennsylvanian, but he was a man whose
character was quite insufficient for his new office. As an injudicious,
short-sighted diplomatist, he had already, when minister at St.
James’s in the days of President Pierce, commended his intrigues for
the annexation of Cuba.
Earlier in 1856 Chief Justice Taney, of the Supreme Court, had
delivered his notorious decision in the Dred Scott case; laying it
down that Congress could not forbid a citizen to carry his property
into the public domain—that is to say, it could not prohibit slavery in
the territories—and that, in the political sense of the word, a negro
was not a “man,” but only property. This decision and the bloody
scenes enacted in Kansas, where settlers from the North and South
were met to struggle for the constitution which should make the
new State either slave or free, greatly exasperated public opinion,
and called forth, among others, the protests of Abraham Lincoln.
In 1858, while Whitman was studying oratory, Lincoln was stumping
Illinois, in those ever-memorable debates which laid bare all the
plots and purposes of the Southern politicians. When the votes in
that contest were counted, Lincoln held an actual majority; but
Douglas was returned as Senator by a majority of the electoral
votes. Though thus defeated, Lincoln was no longer hidden in a
Western obscurity. He was a man with a future; and America had
half-unconsciously recognised him.
Towards the close of 1859, the fire which had been kindled in
Kansas flashed out suddenly in Virginia. America was startled by the
news of John Brown’s raid, and the capture of the arsenal at
Harper’s Ferry.
Brown was among the most remarkable personalities of the time;
and while some saw in him a religious fanatic of the Roundhead
type, who compelled his enemies to pray at the muzzle of his
musket, and who for the Abolition cause would shatter the Union;
others counted him a martyr for the cause of freedom. Emerson had
been one of his most earnest backers when first he went to Kansas;
and now his deed fired the enthusiasm of New England. Thoreau
wrote: “No man in America has ever stood up so persistently and
effectively for the dignity of human nature, knowing himself for a
man, and the equal of any Government”; and when he was hung, it
was Thoreau who vehemently declared that John Brown seemed to
him to be the only man in America who had not died.[240] His high
spirit quickened the conscience of the North, and two years later its
sons marched into Virginia singing the song of his apotheosis.
Whitman was present at the trial of certain of Brown’s abettors in
the State House at Boston;[241] one of a group prepared to effect
their rescue in the event of a miscarriage of justice. Lincoln, on the
other hand, was of those who, in spite of their intense hatred of
slavery, wholly disapproved the Raid. For him, John Brown was a
maddened enthusiast, a mere assassin like Orsini.[242] His attempt
to raise the slaves of Virginia in revolt against the whites was
abhorrent to the Republican statesman whose knowledge of the
South showed him the horrors of a negro rising. Regarding slavery
as the irreconcilable and only dangerous foe of the Republic, Lincoln
held that the Federal Government must restrain it within its actual
bounds; and that the sentiment in favour of gradual emancipation
advocated by Jefferson, the father of the Democratic party, should
be encouraged in the States of the South. But it was the States
themselves that held and must hold the fatal right of choice; it was
for them, not for America, to liberate their slaves.
While the figure of Lincoln was thus becoming more and more visible
to the nation, Whitman was fulfilling his own destiny in New York.
He was born to be a leader of men; but a poet, a path-finder, a
pioneer, not a politician or president. Whatever his noble ambition
might urge, or his quick imagination prompt, he kept his feet to the
path of his proper destiny.
He had a prodigiously wide circle of friends, gathered from every
walk of life: journalists and literary men of all kinds; actors and
actresses; doctors and an occasional minister of religion; political
and public characters; the stage-drivers and the hands on the river-
boats; farmers from the country; pilots and captains of the port;
labourers, mechanics and artisans of every trade; loungers too, and
many a member of that class which society has failed to assimilate
and which it hunts from prison to asylum and poor-house; and he
had acquaintances among another class of outcasts whose numbers
were already an open menace to the life of the Western metropolis,
the girls who sell themselves upon the streets.[243]
Many anecdotes are told of him during these years: how for instance
he would steer the ferry-boats, till once he brought his vessel into
imminent peril, and never thereafter would consent to handle the
wheel; or how, during the illness of a comrade, he held his post,
driving his stage in the winter weather while he lay in the wards of
the hospital; or again, how he took Emerson to a favourite
rendezvous of firemen and teamsters, his good friends, and to the
astonishment of the kindly sage, proved himself manifestly one of
them.
A doctor at the old New York Hospital,[244] a dark stone building
surmounted by a cupola, and looking out over a grassy square
through iron gates upon Pearl Street, often met him in the wards,
where he came to visit one or other of his driver friends, and
enjoyed the restful influence of his presence there or in the little
house-doctor’s room. In those days, when Broadway was crammed
with vehicles and with stages of all colours, much as is the Strand
to-day, the proverbial American daring and recklessness gave ample
opportunity for accidents. As to the drivers, they were generally
country-bred farmers’ sons, fine fellows, wide-awake and thoroughly
conversant with all that passed in the city from the earliest grey of
dawn till midnight: and Whitman found some of his closest comrades
in their ranks.
Sometimes a member of the hospital staff would go over with him to
Pfaff’s German restaurant or Rathskeller on Broadway; a large dingy
basement to which one descended from the street. Here, half under
the pavement, were the tables, bar and oyster stall, whereat the
Bohemians of New York were wont to gather, and in a yellow fog of
tobacco-smoke denounce all things Bostonian. John Swinton, a
friend of Alcott and of Whitman, belonged to the group,[245] and
among those who drank Herr Pfaff’s lager-beer, and demolished his
schwartz brod, Swiss cheese, and Frankfurter wurst, were many of
the brilliant little band which at this time was making the New York
Saturday Press a challenge to everything academic and respectable.
It was here that a young Bostonian, paying his first visit to the city in
1860,[246] found Whitman installed at the head of a long table,
already a hero in that revolutionary young world. The Press was his
champion, and his voice was not to be silenced. Mr. Howells, for it
was he, had been amused and amazed at the ferociously profane
Bohemianism of the worthy editor, who had lived in Paris, and now
worshipped it in the person of Victor Hugo as much as he detested
Longfellow and Boston.
Mr. Howells was astonished and deeply impressed by the
extraordinary charm, gentleness and benignity of the man whom the
Press was extolling as arch-anarch and rebel. Whitman’s eyes and
voice made a frank and irresistible proffer of friendship, and he gave
you his hand as though it were yours to keep. An atmosphere of
unmistakable purity emanated from him in the midst of that
thickness of smoke, that reek of beer and oysters and German
cooking. He was clean as the sea is clean. He passed along the
ordinary levels of life as one who lives among the mountains, and
finds his home on Helicon or Olympus.
Ada Clare[247] (Mrs. Julia Macelhinney), by all accounts a charming
and brilliant woman, was queen of this rebel circle, and especially a
friend of Whitman’s. News of her tragic death from hydrophobia,
caused by the bite of her pet dog, came as a terrible shock to all
who had known her. He had other women friends, notably Mrs.
“Abby” Price, of Brooklyn, and her two daughters.[248] The mother
was an incurable lover of her kind, whose hospitality to the outcast
survived all the frauds practised upon it.
The haunted faces of the needy were becoming only too familiar
both in New York and Brooklyn. The winter of 1857-58 had been a
black one:[249] banks had broken, and work had come to a
standstill; and there had been in consequence the direst need
among the ever-increasing class of men who were wholly dependent
upon their weekly earnings. The rise of this class in a new country
marks the advent of the social problem in its more acute form: and
from this date on there was a rapid development of the usual
palliative agencies, missions, rescue-homes and what-not. The
permanent problem of poverty had made its appearance in America.
It need hardly be added that at the same time there were many
evidences of the growing wealth of another class of the citizens,
those whose profits were derived from land-values and the
employment of wage-labour. The brown-stone characteristic of the
modern city was now replacing the wood and brick which had
hitherto lined Broadway,[250] as private houses gave way to shops
and offices, hotels and theatres. Residences were built farther and
farther up-town; and the Quarantine Station on Staten Island, which
stood in the way of a similar expansion in that desirable quarter, was
burnt out by aspiring citizens. And meanwhile the pressure of life in
the East-side rookeries was growing more and more tyrannous.
The foundering of a slave-ship off Montauk Point was one of the
more striking reminders of the menace of vested interests to all that
the fathers of the Republic had held dear.[251] For even the slave
trade was now being revived, and the hands of Northern merchants
were anything but clean from the gold of conspiracy. Sympathy for
the “institution” and its corollaries was strong in New York, and was
not unrepresented at Pfaff’s. It must have been about the close of
1861,[252] or a little later, that one of the Bohemians proposed a
toast to the success of the Southern arms. Whitman retorted with
indignant and passionate words: an altercation ensued across the
table, with some show of ill-mannered violence by the Southern
enthusiast; and Whitman left his old haunt, never to return till the
great storm of the war had become a far-away echo.
WHITMAN AT FORTY
There are two portraits which belong to the Pfaffian days. In either
he might be the stage-driver of Broadway, and his dress presents a
striking contrast with the stiff gentility of the orthodox costume, the
silk hat and broadcloth, of the correct citizen. He is a great
nonchalant fellow, with rough clothes fit for manual toil; a coat
whose collar, by the way, has a rebellious upward turn; a waistcoat,
all unbuttoned save at a point about half-way down, exposing the
loose-collared shirt surrounded by a big knotted tie. The trousers are
of the same striped stuff as the vest; one hand is thrust into a
pocket, the other holds his broad brim.
In the photograph, which alone is of full length, the face is strong
and kindly, as Mr. Howells saw it; but in the painting, which dates
from 1859,[253] and is valuable as showing the florid colouring of the
man at this time—the growth of hair and beard, though touched
with grey, very vigorous and still dark, the eyebrows almost black,
the face handsome, red and full as of an old-time sea-captain—the
aspect is heavy and even a little sinister. Probably this is a clumsy
rendering of that lethargic and brooding condition which the
occupation of sitting for a portrait would be likely to induce; and in
this it is curiously unlike that of the photograph.
The pose in the latter is unstudied and a little awkward; one cannot
help feeling that the man ought to loaf a little less. The head is
magnificent, but the knees are loose. There was something in
Whitman’s character which this full-length portrait indicates better
than any other; something indefinite and complacent, which
matched with his deliberate and swaggery gait. It is a quality which
exasperates the formalists, and all the people who feel positively
indecent in anything but a starched shirt.
Whitman wore the garb and fell naturally into the attitudes of the
manual worker. When he was not at work he was relaxed, and stood
at ease in a way that no one could mistake. And when he went out
to enjoy himself he never donned a tail-coat and patent shoes.
Something in this very capacity for relaxation and looseness at the
knees made him more companionable to the average man, as it
made him more exasperating to the superior person. The gentility of
the clerical mannikin of the office was utterly abominable to him; so
much one can read in the portrait, and in the fact that he persisted
in calling himself Walt, the name which was familiar to the men on
the ferry and the road.[254]
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com