Learn Data Analysis with Python: Lessons in Coding First Edition A.J. Henley instant download
Learn Data Analysis with Python: Lessons in Coding First Edition A.J. Henley instant download
https://ebookmeta.com/product/learn-data-analysis-with-python-
lessons-in-coding-first-edition-a-j-henley/
https://ebookmeta.com/product/learn-python-by-coding-video-games-
intermediate-a-step-by-step-guide-to-coding-in-python-fast-
patrick-felicia/
https://ebookmeta.com/product/tiny-python-projects-learn-coding-
and-testing-with-puzzles-and-games-1st-edition-ken-youens-clark/
https://ebookmeta.com/product/learn-python-by-coding-video-games-
beginner-1st-edition-patrick-felicia/
https://ebookmeta.com/product/figures-of-natality-reading-the-
political-in-the-age-of-goethe-1st-edition-joseph-d-oneil/
https://ebookmeta.com/product/dk-eyewitness-madrid-travel-guide-
dk-eyewitness/
https://ebookmeta.com/product/clinical-dermatology-5th-edition-
richard-b-weller-hamish-j-a-hunter-margaret-w-mann/
https://ebookmeta.com/product/the-lost-child-complex-in-
australian-film-jung-story-and-playing-beneath-the-past-1st-
edition-terrie-waddell-2/
https://ebookmeta.com/product/sons-of-abraham-vol-2-pawns-of-
terror-1st-edition-joseph-ray/
An Analysis of Robert E Lucas Jr s Why Doesn t Capital
Flow from Rich to Poor Countries 1st Edition Padraig
Belton
https://ebookmeta.com/product/an-analysis-of-robert-e-lucas-jr-s-
why-doesn-t-capital-flow-from-rich-to-poor-countries-1st-edition-
padraig-belton/
A. J. Henley and Dave Wolf
Dave Wolf
Sterling Business Advantage, LLC, Adamstown, Maryland, USA
While the advice and information in this book are believed to be true
and accurate at the date of publication, neither the authors nor the
editors nor the publisher can accept any legal responsibility for any
errors or omissions that may be made. The publisher makes no
warranty, express or implied, with respect to the material contained
herein.
What Is Anaconda?
Getting Started
Your Turn
Your Turn
Your Turn
Your Turn
Your Turn
Your Turn
Your Turn
Cleaning Data
Standardizing Dates
Binning Data
Selecting Columns
Your Turn
Your Turn
Sorting Data
Your Turn
Correlation
Your Turn
Regression
Your Turn
Your Turn
Your Turn
Your Turn
Your Turn
Your Turn
Your Turn
Graph a Dataset:Histogram
Your Turn
Your Turn
Graph a Dataset:Scatter Plot
Your Turn
Analysis Exercise 1
Analysis Exercise 2
Analysis Exercise 3
Analysis Exercise 4
Analysis Project
Required Deliverables
Index
About the Authors and About the
Technical Reviewer
About the Authors
A. J. Henley
Dave Wolf
If you are already using Python for data analysis, just browse this
book’s table of contents. You will probably find a bunch of things
that you wish you knew how to do in Python. If so, feel free to turn
directly to that chapter and get to work. Each lesson is, as much as
possible, self-contained.
What Is Anaconda?
Anaconda is the easiest way to ensure that you don’t spend all day
installing Jupyter. Simply download the Anaconda package and run
the installer. The Anaconda software package contains everything
you need to create a Python development environment. Anaconda
comes in two versions—one for Python 2.7 and one for Python 3.x.
For the purposes of this guide, install the one for Python 2.7.
Anaconda is an open source data-science platform. It contains
over 100 packages for use with Python, R, and Scala. You can
download and install Anaconda quickly with minimal effort. Once
installed, you can update the packages or Python version or create
environments for different projects.
Getting Started
1. Download and install Anaconda at
https://www.anaconda.com/download .
path_to_zip_file = "datasets.zip"
directory_to_extract_to = ""
import zipfile
zip_ref = zipfile.ZipFile(path_to_zip_file, 'r')
zip_ref.extractall(directory_to_extract_to)
zip_ref.close()
I was in fact covered from head to foot with the proof of their
perspicuity. And as a result all the detachments to Frongoch from
Stafford were held back for three weeks to cover the period of
infection.
Thus I spent nearly a fortnight in hospital in the company of an
R.A.M.C. corporal who was isolated with me. He had been a
Northumberland mines inspector, and we discussed the working of
mines, their proprietorship and profits, and the virtues of Trades
Unions. Sometimes my friend the sergeant came and stood out of
sight, and beyond infection, behind the door. He informed me that it
had been discovered that I had written a book on Shakespeare, and
that I was to be treated with respect accordingly. He seemed to be
somewhat amused at this. But my corporal snorted with northern
scorn, and declared that if I could not be treated with respect as a
man, I should not be treated with respect as a man who had written
books. So, with one hand, one touched both ends of English society.
When I rose I was informed by the Commandant that I was not to
rejoin the others. Since I had been ill, it appeared, instructions had
been received that I and another were to be isolated. That other (H.
P.) was already in a cell in the Crescent, where I was to be taken. He
and I would be allowed to speak to one another whenever the staff
arrangements permitted of it; but never, under any circumstances,
were we to be allowed to communicate with the others. And, at the
same time, he handed me my official order of internment, stating
that according to regulations drafted for dealing with “aliens,” I was
to be interned because I was “reasonably suspected of having
favoured, promoted or assisted an armed insurrection against His
Majesty.”
It was easy to see a craftier hand than that of the War Office at
work in this. Yet, by isolating us they magnified us: a result, indeed,
that the smallest wit could have foreseen. We were exercised
together in the afternoon; and when, the first day, we passed within
sight of the others they hailed us unitedly from the distance.
Thereafter we were not permitted to pass within sight of them.
The rooms into which we had been put had been designed for
consumptive prisoners, and contained bracket beds attached to the
wall. The walls were plastered and smooth, and painted in a pleasing
combination of two greens. Little things; but what they meant to
anyone who had to spend his day sitting in a small cell! What chiefly
delighted me, however, was the blanket on my bed. It would have
given joy to a Red Indian chief. Its colours were green, claret, and
yellow. It lay on my bed like a spread cockatoo. Life could not be
drab with that to look upon. Moreover, I had books, and I was
allowed foolscap on which to write. So with books, pen and blanket,
the days passed with as much ease as a prison could give. For,
strangely enough, though the severity of our condition had been
much relaxed, the presence and the effect of the system remained.
Books that demanded any thought in the reading were avoided; the
mind seemed incapable of the effort they demanded; as soon as a
page were read it passed from the memory, and the mind became
once again a blank. One rebelled against this at first, and sought to
conquer it; but when the will demanded an effort, the brain replied
that such efforts were for another, not for this world, that the soul
could not realise itself in a world that had been wrought as nearly as
possible to resemble a vacuum.
A sergeant had been placed in charge of the two of us, a grown
child of a man, with all a child’s shrewdness and sharpness, and
from him we received many friendly acts in spite of the fact that he
seemed constantly to live in fear of some judgment that would alight
on him. He would take me into H. P.’s cell for conversation, and he
came to the tolling of the gong without a murmur or complaint. And
for twenty minutes each day I saw my wife at the iron gate—who, in
truth, lived her days at that gate.
Then one day Father Moore came into my room and sat on my bed,
with the tears in his eyes. “They’re taking the men away from me,”
he said. The dear man was heart-sore at the parting that now
began. Every few days saw the men leaving in batches of fifty to a
hundred on their way to Frongoch. Sometimes from a distance we
could see them going. More often we had to rely on news brought
us from our sergeant. The final stage of our journey was to begin;
for we nothing doubted that our destination was to be the same as
theirs—Frongoch, from which place no good reports came.
It was not till they had all gone, and we had had the long desolate
prison to ourselves for over a week that we were informed that we
were not to go to Frongoch, but were to be removed to Reading Jail.
The others having gone, and the fear of our contamination removed,
we had been permitted the run of the prison; and quite probably we
were the only prisoners in all time who paced alone a long prison
that echoed to our steps. The effluence of many thousands of
prisoners was about us; and we entered the cells to find the names
they had scratched and to reconstruct their history.
Then one morning, July 10th, we were marched out under yet
another sergeant’s guard for Reading Jail.
XVIII.
Reading Jail that day was a mustering of the clans. All the isolation
men from the various prisons, Wakefield, Knutsford, and
Wandsworth, including many who had been to Frongoch, were
gathered together at Reading. It was meant as an elect company;
but it was not at all as elect as the selectors imagined. We ourselves
entertained no delusions on that head. One of the most
distinguished of our company had been wildly hailed on his arrival
months before at Wandsworth, as the man who “’ad been a-hinciting
of ’em”; and apparently the net had been thrown to sweep into
Reading all those who “’ad been a-hinciting of ’em”; but the net had
had a singularly faulty mesh. Even the original net that had swept
through the country during the month of May, carefully though it
had been wrought, and thoroughly though it had been cast, had had
a mesh none too perfect. There were but twenty-eight of us
gathered together that day; and we had, as it were, a double crown
pressed on our heads; but we made haste to disown the title to
wear it.
Yet we were glad to meet. National work necessarily intersects at
many points, and so most of us who foregathered that day for our
months of association had met before in differing combinations, and
at different times, in differing groups of work that were but part of
the one great work. Yet we had never met in that particular
combination before. Some came representing the leadership of large
districts, counties or cities, and some represented national
leadership from some more central focus. The provinces were indeed
as nearly represented as they could well be: eight came from
Connacht, seven from Leinster, seven from Munster, and six from
Ulster; or, fourteen from Leth Chuinn and fourteen from Leth
Mhogha. It was exceedingly well arranged. Though we were not as
complete as we might have been, though we did not venture to
conceive of ourselves as an assembly either inclusive or exclusive of
anything, yet the general representation was very evenly matched.
And it was yet more evenly when, two days later, another Ulster
representative arrived; for, as it so fell out, a Connacht man had
been elected as Ceannphort, and so the provinces were left matched
with a perfect seven apiece.
Such was the skill the Government of England had taken to see, not
only that we had an opportunity of meeting and understanding one
another such as we never could have hoped for, but that we should
meet as a well-balanced and proportionate whole. The care with
which this was wrought must have been considerable.
The only drawback to our assembly was the uncertainty of date
when we discontinue it, and the building in which we met.
XVIII.
Reading, being set deep in a valley at the confluence of two rivers, is
an unhealthy town, close and sultry by summer, and damp and misty
by winter. The gaol is a handsome building, erected in red brick after
the manner of an old castle, with battlements and towers. One
almost expected a portcullis to be lowered at the great gate; and
when we were within the double gates we certainly felt as though a
portcullis had been drawn after us. We stood in a small cobbled
yard. Behind us was the broad wall in which the double gates were
set, flanked on each side by the Governor’s and the Steward’s
houses. Before us a flight of stone steps arose, leading to the
offices, behind which was the large male prison. To the right a wall
arose dividing us from the work yard; and on the left a high blind
wall arose, pierced only by a single door near the wall round the jail.
This was the female prison—ordinarily so, but for the time being our
habitation.
Yet what astonished me most was the sight of flowers. Their
presence made the cobbled yard and the precincts seem almost
collegiate. In neatly kept beds about the walls they lifted their heads
with a happy gaiety very strange to some of us who had known so
human a touch banished from buildings more appropriately given
over to the possession of flints and cinders. A few days after we
were taken through the work yard behind the main prison. Here in
the work hall a canteen was opened on three days in the week for
the interned prisoners who now occupied the prison, but here also
was the large exercise yard, and it was covered with an abundance
of flowers. The familiar asphalt paths could not be seen where they
threaded their way amid blossoms. In beds beneath the walls tall
flowers lifted their heads, and even the graves of hanged men could
not be seen beneath the blooms that covered them.
It was an amazing sight. There were not merely flowers, a sight
astonishing enough in itself; there was a prodigality of flowers. Then
some of us remembered the cause. One of the graves unlocked the
secret. It was marked with the letters C. T. W., and the date, 1896,
to whom Oscar Wilde’s “Ballad of Reading Jail” had been inscribed,
and in celebration of whose passing the poem had been penned.
But neither milk-white rose nor red
May bloom in prison-air;
The shard, the pebble, and the flint
Are what they give us there:
For flowers have been known to heal
A common man’s despair.
Finally we were permitted one visit a month and two letters each
week, the letters to be written on little slips of paper provided for us.
At first also we were refused the right to receive parcels of food sent
in by friends. This was clearly contrary to the code prevailing for
Prisoners ...; and this also we had annulled.
Therefore our life, as finally adjusted, was on this wise. We were
aroused at seven o’clock, and the orderlies for the day at once laid
the breakfast, which was taken at a quarter to eight. At half-past ten
we were taken out by the warders to the work yard for exercise.
There we disported ourselves as we pleased until we were brought
in for dinner at twelve. In the afternoon we went out, not to the
work yard, but to the small exercise yard at the back of our prison.
This was separated by a wall from the Debtors’ Yard, of which Wilde
had sung:
In Debtors’ Yard the stones are hard,
And the dripping wall is high.
Then tea at five—
And the bitter bread they weigh in scales
Is full of chalk and lime.
After tea, during the summer months, we were allowed out into the
yard again till it was dark, and at ten the key grated against us once
more in our cell doors.
Each narrow cell in which we dwell
Is a foul and dark latrine,
And the fetid breath of living death
Chokes up each grated screen,
And all, but Lust, is turned to dust
In Humanity’s machine.
XX.
We were treading a path that had already been sung (for even
bitterness has its song) but we trod it in greater comfort. Above all
we had one another’s company. The boon of this might conceivably
have been blurred a little, as with the passage of months it became
difficult in our cramped space to avoid treading on one another’s
toes. And certainly it was impossible for each man not to know each
other at his best and worst. The knowledge so gained had its value
for future days. For at bottom the solidity with which we began was
only cemented with the passage of time.
Yet our company was first to be revised, by a process of addition
and subtraction, before it took its final shape. One Friday in August
we were informed that on the Monday and Tuesday following we
were to be taken in two parties before the Advisory Committee. We
were asked to give our word that we would make no attempt to
escape. If we gave that pledge we would be sent to London with
warders in plain clothes; otherwise it would be necessary to send us
handcuffed together. On this a keen discussion took place; for while
the majority was content to give the undertaking there were some
who would give no pledge, who would leave it to the authorities to
decide for themselves on any action they pleased. Finally the
Governor, who was very anxious to avoid handcuffs, assumed an
undertaking, and so the issue was muffled. Two warders in plain
clothes accompanied each party to Wormwood Scrubbs Jail; and
nothing was done to advertise the fact that we were prisoners
travelling. Had the question arisen a few months later hardly a man
would have given the undertaking, or even have suffered it to be
implied. The public display of handcuffs would have been coveted
rather than avoided; for it was certainly not to comfort us that the
offer was made, whatever the Governor’s personal inclinations might
have been. For jails but straighten the back and harden the mind.
We also differed in our attitude towards the Advisory Committee.
None of us differed in our opinion of its function. It sat, so the
purport ran, to decide which of us might be liberated; or rather,
more technically, in respect of which of us our internment orders
should be confirmed; but these things, as we know, would be
decided by political considerations quite outside the review of the
Committee. None of us doubted that its main function was to check
and complete our Leabhrain, as far as possible, by question and
cross reference. But we differed in our attitude. Some refused to
recognise the Committee in any way, as being a body set up by a
foreign government, having no authority over Irishmen. These, when
brought before the Committee, firmly defined their attitude, and
were promptly escorted again into the outside air. Others answered
the brief interrogatory to which they were submitted, and went their
way in a matter of minutes. My own attitude was somewhat
different.
In the first place, I had now been in prison for some months,
without much chance of enlivenment. The opportunity of a debate
through the labyrinth of the Defence of the Realm Regulations
seemed too good a thing to be lightly put by. Moreover, I was
anxious to discover some of the items that furnished my leabhran. I
was not disappointed. As I had expected, deftly mixed among the
questions put to me about my own doings were a number of
questions that involved others. Also, as I had expected, a week’s
study of the Regulations left the rather interesting legal debate not
altogether a one-sided matter; for a number of points were
conceded to me, which, when I afterwards sought to take advantage
of them, proved to have been made without any deep knowledge of
the possibilities the Regulations offered. One or two matters of
interest emerged, however.
For instance, the Committee had some little difficulty in explaining
exactly why, if I as an Irishman was to be interned as an
This, I was told, was a political matter. Strangely enough, it was
exactly so I had conceived it. Then I was informed that I was only
considered as an alien for the purposes of that particular act, that in
other matters my citizenship under the law was not disputed. By
which it appeared that I was an alien when my imprisonment was
desired, but not an alien when my personal and national freedom
was to be consulted.
Then, among other questions, I was asked if I had or had not
endeavoured to get Irish farm labourers into touch with Irish farmers
in order to stay their migrating to England, where they could be
taken under the Military Service Act. On my asking on what authority
the question was put, I was answered that it was so alleged in the
local police report. My answer was an admission of the charge. I
suggested that it might have a bearing that the assurance had been
made in Parliament that farm labourers from Ireland could not be
taken under the Military Service Act. But it was interesting to
discover that a benefit intended to Ireland was made the basis of a
charge; and it was interesting to discover the furniture that found its
way into police reports.[A]
When I came out and explained how it was I had remained so long,
when all the others had been dispatched in two minutes or three, I
was told that I had at least ensured continued internment. The price
was not exhorbitant.
FOOTNOTE:
[A] It seems worthy of note that as I write in the year 1917 the
Department of Agriculture and Technical Education have adopted
this scheme, and are being assisted in its prosecution by the
police. It took a Clown to refer to Time as a whirligig.
XXI.
The week after our excursion to Wormwood Scrubbs, seven men
were sent down to us from Frongoch, where trouble had already
begun. There were no cells to hold them in our prison, and so they
were lodged in the reception-cells under the offices, where neither
light nor air was bold enough to venture. They were brought over to
us for breakfast, and lived during the day with us until they were
taken back to bed.
Shortly afterwards five of our number were summoned to the
Governor’s office, and returned saying they were to be released that
day. We already had had that joke played on us several times, and
so we gave no heed to them. But when in a short time we saw them
industriously packing their kit, the joke wore a more earnest
expression. It was no jest, however. Although no man changed his
mien yet none but felt what a jewel freedom was when it became
within the grasp of his neighbour, and when that neighbour rose up
and went forth proudly wearing it. We sang them home, however,
gaily enough. In a week two more were sent home. These seven
comprised all the releases from Reading at the same time that two
thousand and more were released from Frongoch. It was not very
difficult to discover the reasons prompting most of these releases,
and it need hardly be said that they had little relation to the events
of Easter Week. The internments covered a much wider ground,
which was chosen for much subtler reasons. The soldier’s hand
might rule in Ireland, but the politician’s hand indexed the
internments. And as usual the politician over-reached himself. For
the men who were released found on their return that the country
judged them unworthy to remain; and the Home Office officials were
finally convinced that Ireland was inhabited by the mad when they
received shoals of letters from released men pitifully arguing that
their releases must have been in error, and giving proofs of their part
in the Rising-Out.
We, however, settled down to the honour of imprisonment with
fortitude. Already, when we had learned that the celebrations of the
12th of July had been forbidden in Ulster we had filled the gap with
a procession and a meeting in which excellent Orange speeches had
been made. Now we held a Hibernian meeting. Such things
enlivened our days.
We suffered greatly from lack of exercise, and the closeness of our
confinement began to tell upon us as the autumn approached. We
had given up going out to the work-yard for our morning exercise,
and kept to the little yard. This yard was beset on three sides by the
buildings of the jail, and on the fourth side, beyond the high wall,
Huntley & Palmer’s chimneys belched black smoke that blotted the
sky. In a corner of this yard we made a hand-ball alley. No stranger
alley was ever devised. Two windows, a drain-pipe, a railing across
steps leading to the basement, and a ventilator grating, gave
opportunity for chance and skill. And the exercise saved us.
Nevertheless, with the coming of winter the effects of our
confinement could be seen on most of us. The food, also, had
become bad. The margarine was often rancid. On two occasions the
meat made several of us ill; and for three months I lived only on
bread and porridge, both of which were, at least, clean and
wholesome. Prisons are not built as health resorts, yet precautions
are supposed to be taken that a mean of temperature is maintained.
During a week of frost, however, the temperature in my room was
46° to 48° Fahrenheit. This was inside the cells: outside, the
passage was full of draughts. Yet the prison was never ventilated,
for the only place where air could come or go was the door. The
result was that when one of the warders came in once with
influenza, every man in the prison in time fell to it.
Yet we kept our backs straight. P. J. D. was informed by the
Governor, on the authority of the Home Office, that if he would sign
an undertaking to be of good behaviour for the future he would at
once be liberated. He replied that the offer was adding insult to
injury, and he declared that if his liberation depended on his
signature of any manner of undertaking, he was destined to remain
long in prison. The Chief Warder approached others of us, thinking
to try the ground before any other offers were made; but he left
matters as he found them.
In Frongoch at this time the same attitude was being taken. Matters
there were also complicated by the attempt of the military to search
out Irishmen who had returned home from England on the passage
of the Military Service Act—to search them out, not for the Army, but
for the pleasure of thrusting them into jails. And the result of the
ensuing resistance was that seven of the leaders there were brought
to Reading and put into the reception-cells, making our number
thirty-five once again.
XXII.
So the winter days passed. The prison was wrapt continually in an
unpleasant amalgam of winter fog and Huntley & Palmer’s smoke.
We never saw the sun, though occasionally, when the fog cleared,
we could make a guess at it where it strode the sky.
Little wonder if we occasionally got upon one another’s nerves. None
of our nerves were of the best, and we all felt the deathly system of
prison life like an oppression on us, blotting out all intellectual life
and making a blank of mind and soul. Yet no outsider saw cleavage
among us. That was a principle we never let down.
Of an evening we met together and discussed different aspects of
national affairs, partly with the intention of defining our future
action, and partly with a view to defining our points of view in their
relation to one another. The two things were really one; for
satisfactorily to outline the second was already largely to complete
the first; and we were determined not to lose the chance with which
we had been so admirably furnished. Moreover, when birthdays
arrived we had modest supper-parties, in which song and good will
supplied the lack of viands.
Yet towards the end, with illness and depression settling on most of
us, we kept largely to our own cells, despite their icy temperature.
We were suffered books—carefully selected. It became part of our
business carefully to test the selection by arranging for a variety of
books to be sent in to us by friends. Especially was this so when a
happy accident gave us the name of our censor; and it was deeply
interesting to see his path among the classics of Irish literature.
In this we were assisted by our friends outside. Indeed, not the least
value of our months of imprisonment was the revelation of
friendship, and its spontaneity and strength and unity in those of our
race. We had but to express a need and it was at once met by
leagues and committees that had been gathered together, both at
home and in England, to befriend and serve us. If our state was like
that of an island it was at least an island washed by a great sea of
friendship.
The gifts cast up by the tides of that sea became embarrassing as
Christmas approached. We had altogether to dispense with prison
fare; and our thrills of excitement were not the less because we
were so remote from the outer world. But the full bounty of that sea
was never to be experienced by us.
Shut away though we were, we watched political affairs closely—
watched not merely the surface that appeared, but watched for
indications of the hidden streams that ran—and when John Dillon
brought forward his motion for the discussion of the Irish Prisoners
of War we guessed that he had learned some hint that we were to
be released. This came soon after the failure to get us to sign
pledges of good behaviour. When, however, the threatened motion
was never taken, it was clear that we were not to be released. We
were not greatly affected; but we watched that pending motion with
interest. It became a theme of daily jest with us. When, after the
change of government, the motion at last was discussed, the sign
was clear to us; and we were not surprised when, the following day,
we learned that Irish interned prisoners were to be released. In a
noncommittal way some of us began to pack—like men who were
content, the next moment, to unpack, and take whatever came
without perturbation. On Friday, the 22nd of December, we heard
that the Frongoch men were going, and during that day we learned
that a courier was expected during the afternoon with papers for our
release. No courier, however, arrived; and Sunday saw us content
again to continue as we were without complaint. It appeared, as I
afterwards learnt, that the Home Office had actually arranged for
our release together with the men at Frongoch, but that the Irish
Office had intervened. It was not till the Sunday afternoon that the
Home Office won its way. For on that day, Christmas Eve, at half-
past two, the Governor came into the prison to tell us that we were
to be ready to go out in two hours’ time. It seemed indeed that our