[FREE PDF sample] Mastering Large Datasets with Python Parallelize and Distribute Your Python Code 1st Edition John T Wolohan ebooks
[FREE PDF sample] Mastering Large Datasets with Python Parallelize and Distribute Your Python Code 1st Edition John T Wolohan ebooks
com
https://textbookfull.com/product/mastering-large-
datasets-with-python-parallelize-and-distribute-
your-python-code-1st-edition-john-t-wolohan/
https://textbookfull.com/product/begin-to-code-with-python-rob-miles/
textbookfull.com
https://textbookfull.com/product/supercharged-python-take-your-code-
to-the-next-level-brian-overland/
textbookfull.com
https://textbookfull.com/product/adaptive-behavior-and-learning-2nd-
edition-j-e-r-staddon/
textbookfull.com
Best tent camping Northern California your car camping
guide to scenic beauty the sounds of nature and an escape
from civilization Fifth Edition Speicher
https://textbookfull.com/product/best-tent-camping-northern-
california-your-car-camping-guide-to-scenic-beauty-the-sounds-of-
nature-and-an-escape-from-civilization-fifth-edition-speicher/
textbookfull.com
https://textbookfull.com/product/theory-and-experiment-in-
gravitational-physics-clifford-m-will/
textbookfull.com
https://textbookfull.com/product/a-course-for-teaching-english-
learners-3rd-edition-diaz-rico/
textbookfull.com
https://textbookfull.com/product/tim-maia-s-tim-maia-racional-
vols-1-2-first-edition-thayer/
textbookfull.com
Theory and Applications of Heat Transfer in Humans 1st
Edition Devashish Shrivastava
https://textbookfull.com/product/theory-and-applications-of-heat-
transfer-in-humans-1st-edition-devashish-shrivastava/
textbookfull.com
Mastering Large Datasets with
Python: Parallelize and
Distribute Your Python Code
John T. Wolohan
Copyright
For online information and ordering of this and other Manning books,
please visit www.manning.com. The publisher offers discounts on
this book when ordered in quantity. For more information, please
contact
20 Baldwin Road
PO Box 761
Email: [email protected]
20 Baldwin Road
PO Box 761
ISBN: 9781617296239
1.
Chapter 1. Introduction
Chapter 2. Accelerating large dataset work: Map and parallel
computing
Chapter 3. Function pipelines for mapping complex
transformations
Chapter 4. Processing large datasets with lazy workflows
Chapter 5. Accumulation operations with reduce
Chapter 6. Speeding up map and reduce with advanced
parallelization
2.
Chapter 7. Processing truly big datasets with Hadoop and Spark
Chapter 8. Best practices for large data with Apache Streaming
and mrjob
Chapter 9. PageRank with map and reduce in PySpark
Chapter 10. Faster decision-making with machine learning and
PySpark
3.
Chapter 11. Large datasets in the cloud with Amazon Web
Services and S3
Chapter 12. MapReduce in the cloud with Amazon’s Elastic
MapReduce
Index
List of Figures
List of Tables
List of Listings
Table of Contents
Copyright
Brief Table of Contents
Table of Contents
Preface
Acknowledgments
About this book
About the author
About the cover illustration
1.
Chapter 1. Introduction
1.1. What you’ll learn in this book
1.2. Why large datasets?
1.3. What is parallel computing?
1.3.1. Understanding parallel computing
1.3.2. Scalable computing with the map and reduce style
1.3.3. When to program in a map and reduce style
2.4. Exercises
2.4.1. Problems of parallelization
2.4.2. Map function
2.4.3. Parallelization and speed
2.4.4. Pickling storage
2.4.5. Web scraping data
2.4.6. Heterogenous map transformations
Summary
3.4. Exercises
3.4.1. Helper functions and function pipelines
3.4.2. Math teacher trick
3.4.3. Caesar’s cipher
Summary
Summary
Summary
2.
Chapter 7. Processing truly big datasets with Hadoop and Spark
7.1. Distributed computing
7.2. Hadoop for batch processing
7.2.1. Getting to know the five Hadoop modules
7.6. Exercises
7.6.1. Hadoop streaming scripts
7.6.2. Spark interface
7.6.3. RDDs
7.6.4. Passing data between steps
Summary
8.5. Exercises
8.5.1. Hadoop data formats
8.5.2. More Hadoop data formats
8.5.3. Hadoop’s native tongue
8.5.4. Designing common patterns in MRJob
Summary
9.3. Exercises
9.3.1. sumByKey
9.3.2. sumByKey with toolz
9.3.3. Spark and toolz
9.3.4. Wikipedia PageRank
Summary
Summary
3.
Chapter 11. Large datasets in the cloud with Amazon Web
Services and S3
11.1. AWS Simple Storage Service—A solution for large datasets
11.1.1. Limitless storage with S3
11.1.2. Cloud-based storage for scalability
11.1.3. Objects for convenient heterogenous storage
11.1.4. Managed service for conveniently managing large
datasets
11.1.5. Life cycle policies for managing large datasets over time
11.3. Exercises
11.3.1. S3 Storage classes
11.3.2. S3 storage region
11.3.3. Object storage
Summary
12.3. Exercises
12.3.1. R-series cluster
12.3.2. Back-to-back Hadoop jobs
12.3.3. Instance types
Summary
Index
List of Figures
List of Tables
List of Listings
Preface
The idea for this book came to me in the summer of 2018 after
working with some especially talented developers who had managed
to go a significant portion of their careers without learning how to
write scalable code. I realized then that a lot of the techniques for
“big data” work, or what we’ll refer to in this book as “large dataset”
problems, are reserved for those who want to tackle these problems
exclusively. Because a lot of these problems occur in enterprise
environments, where the mechanisms to produce data at this scale
are ripe, books about this topic tend to be written in the same
enterprise languages as the tools, such as Java.
This book is a little different. I’ve noticed that large dataset problems
are increasingly being tackled in a distributed manner. Not
distributed in the terms of distributed computing—though certainly
that as well—but distributed in terms of who’s doing the work.
Individual developers or small development teams, often working in
rapid prototyping environments or with rapid development languages
(such as Python), are now working with large datasets.
My hope is that this book can bring the techniques for scalable and
distributed programming to a broader audience of developers. We’re
living in an era where big data is becoming increasingly prevalent.
Skills in parallelization and distributed programming are increasingly
vital to developers’ day-to-day work. More and more programmers
are facing problems resulting from datasets that are too large for the
way they’ve been taught to think about them. Hopefully, with this
book, developers will have the tools to solve those big data problems
and focus on the ones that got them interested in programming in
the first place.
Acknowledgments
A special thanks to all the developers of and contributors to the
excellent tools I’ve covered in this book, as well as all the wonderful
folks at Manning who helped make this book possible: Stephen
Soehnlen, Marina Michaels, Aleksandar Dragosavljevic, Deirdre Hiam,
Carl Quesnel, Keri Hales, and Barbara Mirecki. Also thank you to my
technical proofer, Al Krinker, and technical developmental editor,
Michael Smolyak.
In chapter 2, I introduce the map part of the map and reduce style,
and we look at how to parallelize a problem to solve it faster. I cover
the process of pickling in Python—how Python shares data during
parallelization—and we’ll tackle an example using parallelization to
speed up web scraping.
In chapter 11, I cover the basics of cloud computing and the nature
of cloud storage. We’ll put our learning into practice by loading data
into Amazon S3 using both the web GUI and the boto3 AWS API
wrapper library for Python.
$ source mastering_large_datasets/bin/active
Beyond Python, the only software that you’ll need for this book is
Hadoop. The easiest way to install Hadoop is to go to the Hadoop
website and follow the instructions for downloading Hadoop there:
https://hadoop.apache.org/releases.html. Hadoop is written in Java,
so you’ll also need to have a Java Development Kit installed to run it.
I recommend OpenJDK. You can download OpenJDK from the
OpenJDK website: https://openjdk.java.net/.
Finally, to complete the last two chapters of the book, you’ll need an
AWS account. You can create a new AWS account by going to
https://aws.amazon.com, selecting “Sign in to the Console,” and
then creating a new AWS account. To set up your account, you’ll
need to provide a payment method. Amazon will use this method to
charge you for resources you use. For this book, you won’t need
more than $5 of resources from AWS. To ensure you don’t spend
more than you’re comfortable with, you can get a prepaid Visa card
and set that up as your payment method. You can find prepaid Visa
cards at stores like CVS, Walgreens, Rite-Aid, Target, and Walmart,
as well as many convenience stores and gas stations. You won’t
need an AWS account until chapter 11.
The way we dress has changed since then and the diversity by
region, so rich at the time, has faded away. It is now hard to tell
apart the inhabitants of different continents, let alone different
towns, regions, or countries. Perhaps we have traded cultural
diversity for a more varied personal life—certainly for a more varied
and fast-paced technological life.
We shall see that taking care of your baby before he is born means
taking such care of yourself throughout pregnancy, that you not only
keep your own body in its usual good running order, but in addition,
so effectively promote the activities of your various organs that you
also keep the baby’s body going, his body that is growing all the time.
Quite reasonably this requires extra work on the part of some of
your organs, particularly those concerned with digestion and the
process of throwing off impurities. The latter is of the greatest
possible importance for in addition to excreting the usual amount of
impurities from your own body you must excrete also those thrown
off by your baby. The amount of waste from him is not large but it
seems to be of such a character that it harms the mother if it is not
steadily excreted.
Good digestion and satisfactory excretion are dependent upon a
number of factors and fortunately most of them are within your own
control.
Your frame of mind is one of the most important factors of all. I
know that to suggest the cultivation of a cheerful, hopeful mental
attitude is easier said than done. But after all it really is largely a
matter of habit which you can acquire if you set yourself to it,
particularly if you realize that your physical condition will be
benefited by your going through pregnancy happily. And remember
that whatever is good for you is good for your baby.
Continue with the work, amusements and exercise that you are
used to and enjoy, except of course such activities as the doctor may
forbid. In general, try to forget that you are pregnant, so far as you
can do this and still remember to take proper care of yourself.
Above all, don’t worry. Worry will interfere with your sleep and it
will also upset your digestion quite as seriously as will wrong food.
Try not to be too self-centered or too watchful of your symptoms, but
at the same time avoid the dangerous habit of thinking that any
unusual condition which develops is due to your being pregnant, for
a sick pregnancy is not normal.
It will relieve you of a great deal of anxiety if you report to your
doctor everything you do not understand, for the consciousness that
he will know just what to do, if anything is necessary, will help to
keep you from worrying.
It is important, too, for you to get rid of the depressing beliefs in
connection with pregnancy that have come down to us through the
ages.
For instance, do not believe for a moment that anything you do,
think or see can “mark” or deform your baby, for remember that
after conception you give him nothing but nourishment. The only
communication between you and the baby is through your and his
blood, and blood does not carry mental impressions. Accordingly, no
effects of fear, horror or unpleasant memories which you may have
can possibly reach him. It is true that once in a while a woman does
see something shocking and later gives birth to a marked or
deformed baby. But there is little doubt, now, that such an
occurrence is merely a coincidence. If you will stop and think for a
moment you will realize that most expectant mothers see or hear or
think something unpleasant at some time during pregnancy, and yet
most babies are born without mark or blemish. Anger, fright or
sudden shock may upset your digestion, but it does not directly affect
your baby.
As for that common belief that in “reaching up” the mother may
slip the cord around the baby’s neck—if you will picture for a
moment how the baby lies within the uterus you will realize how
impossible this is, for the mother’s arms have no connection with
him or the cord.
So dismiss these doubts and fears from your mind and dwell
instead upon the loveliness of what is in store for you, for, I repeat,
your physical condition will be benefited if you go through pregnancy
happily. And remember again that whatever is good for you is good
for your baby.
So your first step toward caring for the little life already within
your charge is to follow the example of Mrs. Wiggs, who constantly
wiped the dust from her rose-colored spectacles.
Now for the more specific details of your care. Of these the
question of your diet is of enormous importance.
Let us consider first what your food accomplishes if it is suitable
and conditions are favorable for its use by you and the baby. It
should provide nourishment for your various tissues, as under
ordinary conditions; it should promote the activities of your skin and
kidneys, as well as bowels, since it is through them that the waste
from your own and your baby’s body must be excreted, and your food
should be adequate also, to build and nourish the baby’s body
without his having to draw materials from your tissues. Strange as it
may seem, the baby’s physical needs are supplied before yours are
met, and if there are not enough food materials for you both, your
bones, teeth and muscles will be deprived. Furthermore, taking
proper food during pregnancy is an important step toward preparing
yourself to nurse your baby, after he is born, which is quite as urgent
as nourishing him before birth.
To accomplish these ends you not only must eat suitable food, but
you must digest and absorb it as well. This requires that you
constantly guard against overeating, constipation and indigestion of
any kind. Indigestion may be avoided during pregnancy exactly as it
is at other times, by eating proper food, by cultivating a happy frame
of mind; by having sufficient exercise, fresh air, rest and sleep.
If you are accustomed to a fairly simple, well balanced, mixed diet,
you probably will need to make little or no change, except to have the
evening meal light if it has been a hearty one. It may surprise you to
learn that you need not “eat for two,” in quantity, as is so commonly
believed necessary, for during pregnancy you make so much better
use of food materials than usual that an amount and kind of food
that keep you in good condition will be adequate to meet your baby’s
needs, too, until the latter part of pregnancy. On the other hand, it is
very unwise for an expectant mother to cut down her diet, with the
idea of keeping the baby small and thus make labor easy, except
under the direction of her doctor. In general it is the size of the
baby’s head that makes labor easy or difficult, and not the amount of
fat distributed over his body. And if the mother cuts down the
minerals in her diet to make the baby bones soft, the only result is
that her own bones and teeth are softened, because the baby extracts
from them enough lime to supply what the food lacks.
Three meals a day will usually be enough during at least the first
half of pregnancy and they should be taken with clock-like regularity,
eaten slowly and masticated thoroughly. The possible need for slight
additional food during the later weeks may be supplied more
satisfactorily by lunches of milk, cocoa or broth and crackers or toast,
between meals and upon retiring, than by taking larger meals. An
expectant mother who has a tendency to nausea early in pregnancy
often feels better for taking a small lunch regularly five or six times
daily instead of the usual three full meals.
It is of the greatest importance that every pregnant woman drink
an abundance of fluid to act as a solvent for her food and waste
material and promote the activity of her kidneys, skin and bowels.
She needs about three quarts daily, most of which should be water,
the remainder consisting of milk, cocoa, soup and other liquids.
Alcohol should not be taken except upon the doctor’s orders and only
moderate amounts of coffee and tea, unless he gives permission for
more.
The expectant mother will be wise to avoid fried food, pastry, rich
desserts, rich salad dressings and any other food which would
ordinarily disagree with her.
Since the enjoyment of one’s meals promotes digestion at all times,
the expectant mother should try to eat the things that she enjoys
most and that agree with her. The average pregnant woman who has
no symptoms of complications will usually be able to supply her own
and her baby’s needs and at the same time keep within the bounds of
safety if she selects her diet from the foods included in the following
groups:
Animal Foods. Milk and eggs are the most satisfactory, but for
the sake of variety and to tempt her appetite the expectant mother
will usually be allowed to take rather sparingly, and preferably only
once a day, of fish, the various kinds of shell fish, beef, lamb, chicken
or game. Pork, veal and goose should be avoided as a rule, and
particularly by women with whom they ordinarily disagree.
Soups. Thin soups and broths have little food value but because
of their appetizing flavor and aroma are an aid to digestion, and
frequently by stimulating a flagging appetite will help the expectant
mother to eat and assimilate more than she would without them. But
cream soups and purées have a high food value and, like thin soups
and broths, also supply a definite amount of fluid which she must
have.
Vegetables. The group of vegetables generally designated as
“leafy” are of even greater importance to the expectant mother than
they are to the average person. Of these she may safely eat onions,
asparagus, celery, string beans, spinach, and she should make a point
of taking a green salad, such as lettuce, cress or romaine, at least
once daily. Sweet potatoes, white potatoes, rice, peas, Lima beans,
tomatoes, beets and carrots, also, may be eaten with safety, as a rule,
but cabbage, cauliflower, corn, egg-plant, Brussels sprouts, parsnips,
cucumbers and radishes should be taken with great caution and
avoided altogether if they cause gas or any kind of distress.
Fresh Fruits. A necessary part of the diet is fresh fruit, and
among those fruits which are both beneficial and usually harmless
are apples, peaches, apricots, pears, oranges, figs, cherries,
pineapple, grapes, plums, strawberries, raspberries, blackberries and
grapefruit. These are more likely to be laxative if eaten alone, as
before breakfast and at bedtime. Cooked fruits are also valuable
articles of diet, but are probably less laxative than raw fruit. Some of
the citrous fruits, oranges, grapefruit or lemons, should be taken
daily because they possess a certain indispensable food value which
is peculiar to them.
Cereals. For their nourishing and laxative qualities, cereals are
important and their food value is increased by the milk and cream
which are usually taken with them. Cooked cereals should invariably
be cooked longer than the usual directions suggest. Bran, eaten alone
as a cereal or in combination with other grains, is an excellent
laxative.
Breads. Graham, cornmeal, whole wheat and bran bread are all
good, in general the expectant mother will be on the safe side if she
eats sparingly, if at all, of very fresh or hot breads and hot cakes.
Desserts. Desserts are very important for they add to the
attractiveness of most people’s meals, and if wisely chosen and
properly made, may supply a good deal of easily digested
nourishment. They may include, in addition to fresh and cooked
fruits and preserves, ice-cream, a wide variety of custards, creams
and puddings made largely of milk, eggs and some ingredient to give
substance and firmness, such as gelatin, cornstarch, rice, tapioca,
farina, arrow-root and similar materials.
In general the expectant mother should eat an abundance of fruit
and vegetables, taking at least some uncooked fruit and a green
salad, daily, and make sure that her food contains a good deal of
residue, such as is provided by fruit and coarse vegetables. This
residue increases the bulk of the material in the intestines, and this
helps to overcome the tendency toward constipation. As fat is less
easily digested than starchy foods, and more likely to cause nausea
during pregnancy, it is better to eat no more fat than usual but to
supply the additional material which is needed after about the sixth
month, by taking a little more starchy food. However, a slight
increase only is necessary, and this chiefly during the last three or
four weeks.
The Kidneys. It is scarcely possible to say enough about the
importance of keeping your kidneys in normal working order during
pregnancy, for through them is excreted much of the waste matter
from your baby’s body as well as your own. Sometimes when these
impurities are not thrown off as they should be the expectant mother
has convulsions. You will be glad to know how much you yourself can
do toward preventing convulsions by drinking plenty of water and by
faithfully measuring your urine and taking a specimen to the doctor
when he asks you to. As I said before, you should drink at least three
quarts of fluid every day. Most of this should be water, the remainder
being milk, cocoa, soup, tea, coffee, and so on.
The doctor will probably want you to measure your urine and take
a specimen to him once a month during the first half of pregnancy
and every two weeks afterward, or even every week toward the end.
He can tell by examining the urine whether your kidneys are acting
as they should and if they are not he may save you serious trouble by
putting you to bed for a few days with no nourishment but milk and
water.
In preparing a specimen you will need a covered corked vessel
large enough to hold all the urine passed in twenty-four hours, and it
must be thoroughly washed and scalded. The next step is to pass
urine, suppose we say at eight o’clock in the morning, and throw it
away. All of the urine which you pass after this time until eight
o’clock the next morning must be saved in the vessel and kept in a
cool place to prevent its decomposing. If you will put a teaspoonful of
chloroform or boracic acid powder into the vessel it will tend to
preserve the urine and will not injure the specimen. At the end of
twenty-four hours the urine should be shaken to mix it thoroughly
and about half a pint poured into a bottle that has been washed and
scalded. Carefully cork and label this with the date, your name and
address and the total amount of urine passed in the twenty-four
hours. The vessel for collecting the urine and whatever you use as a
measure should be reserved for these purposes only. If you have no
tin or glass measure, a regular-size quart tomato can will prove
entirely satisfactory.
If you find, when measuring your urine, that you pass less than a
quart and a half in twenty-four hours, you may know without being
told that this is not enough and that you should drink more water.
The Skin. People are likely to think of the skin as being simply a
covering for the body, whereas, in reality, it is a very complicated and
active organ which helps to regulate the body temperature and
constantly throws off impurities, just as the kidneys do. This latter
function is performed by the sweat glands which open upon the
surface of the skin as the “pores,” and we are told that in all there are
some twenty-eight miles of these tiny tube-like structures in the skin.
These glands should be, and usually are, constantly active; they pour
upon the surface of the body an oily substance which keeps the skin
soft; they also excrete something more than a pint of water daily,
which contains impurities that are harmful if retained in the body.
We are not aware of this constant excretion of fluids, which is termed
“insensible perspiration,” but it continues even in cold weather and
must not be stopped if health is to be preserved. If the oil, dust,
particles of dead skin and the waste material left by dried
perspiration are allowed to remain upon the surface of the body they
will clog the pores, or gland openings, and thus interfere with their
action. The removal of this material, then, is necessary to maintain
health, and is done automatically in part for the fluid evaporates and
much of the solid matter is rubbed off on the clothing. The most
important aids to the skin’s activity are the drinking of plenty of
water, deep breathing, exercise and warm baths.
Regular and thorough bathing serves the double purpose of
removing waste matter already on the surface, and of stimulating the
glands to increased activity in giving off still more.
Many doctors advise a warm, not hot, shower or tub bath every
day, with soap used freely over the entire body, followed by a brisk
rub. The best time for this warm, cleansing bath, as a rule, is just
before retiring, as it is soothing and restful, and tends to induce
sleep. Very hot baths are fatiguing, particularly during pregnancy,
and should never be taken except with the doctor’s permission; but
cold baths usually may be continued throughout pregnancy if one is
accustomed to them and reacts well afterwards. Under these
conditions the morning cold plunge, shower or sponge is beneficial,
as it stimulates the circulation and thus promotes the activity of the
skin. Some doctors forbid tub bathing of any kind after the seventh
month, on the ground that as the expectant mother sits in the tub her
vagina is filled with unsterile water and should labor occur shortly
afterward an infection, or fever, might result. And as she is heavy and
somewhat uncertain on her feet, there is also the danger of her
slipping and falling while getting in or out of the tub. Other doctors
permit tub baths throughout pregnancy, up until the onset of labor;
while as to hot foot baths, since there seems to be no reason for or
against them at any time during the nine months, they may be taken
or not at will.
Bathing in a quiet stream or lake is apparently harmless but sea
bathing, if the surf is rough, is inadvisable because of the beating of
the waves upon the abdomen and the general violence of the
exercise.
The importance of keeping the body evenly warm throughout
pregnancy cannot be overemphasized, for a sudden chilling or
wetting may so check action of the skin as to impose more of a
burden upon the kidneys than they can meet, in their effort to throw
off the skin’s share of the body waste. Accordingly, a single chilling
will sometimes be enough to cause convulsions. This may be one
reason why convulsions occur more frequently during cold weather
or after a sudden drop in the temperature after warm or mild days.
The Bowels. The bowels, also, throw off a certain amount of
impurities and if they do not move thoroughly at least once a day
these impurities may be taken into the system and again the kidneys
be given extra work.
Unhappily a great many pregnant women are constipated,
particularly during the later weeks, while women who have always
had a tendency of this kind may have trouble with their bowels from
the very beginning of pregnancy. Your bowels should move regularly
every day, and to this end you should attempt to empty them at the
same hour each day, immediately after breakfast being the best time.
The importance of regularity in making the attempt cannot be
overemphasized, even though the bowels do not always move.
The measures which tend to prevent constipation, as already
pointed out, are drinking plenty of fluids, and eating fresh fruit,
coarse vegetables and bulky cereals such as bran; also taking a glass
of hot or cold water just before going to bed and the first thing in the
morning. You should not take enemas or cathartics without your
doctor’s order, but you may safely increase the amount of fluids
which you drink and the bulk of your food, in order to regulate your
bowels.
Senna and prunes cooked together prove to be helpful in keeping
the bowels regular and they are entirely harmless. A simple way of
preparing them for this purpose is to pour a quart of boiling water
over an ounce of senna leaves and allow them to stand for about two
hours. A pound of well washed prunes should soak overnight in this
liquor, after it has been strained, and then cooked in it until tender.
They may be sweetened with two tablespoonfuls of brown sugar, and
the flavor improved by adding a stick of cinnamon or slice of lemon
while they are cooking. Half a dozen of these prunes, with some of
the syrup, may be taken at the evening meal to start with, and
increased or decreased in number as necessary.
Clothes. The chief purpose of clothes under all conditions is to
aid in keeping the body warm, thus helping to preserve an even
circulation of the blood and the activity of the sweat glands. As has
been pointed out, this is of especial importance during pregnancy.
The expectant mother’s clothes should be not only sufficiently warm,
but they should be equally warm over her entire body. They should
be light and porous, and fairly loose, so as not to interfere with the
circulation or other bodily functions. There must be no pressure on
chest or abdomen; no tight garters, belts, collars or shoes.
The clothes of the mother-to-be, like every other detail of her care,
must be adapted to her surroundings and mode of living. If her
house is well and evenly heated during the cold months, she may
quite safely dress lightly while indoors; if it is not, she should wear
underwear with high neck, long sleeves and drawers, both indoors
and out, except when the weather is warm enough to cause
perspiration. At all times, however, the warmth of her clothing
should be suited to the temperature of the home, the climate and the
state of the weather.
Remembering that it is important for you to keep up the diversions
and amusements that you enjoy, it is worth while to have your
clothes as pretty and becoming as possible, for you are much more
likely to go about and mingle with your friends if you feel that you
are becomingly and well dressed. At the same time your clothes
should be so made that their weight will hang from the shoulders
instead of from the waistband.
And that brings us to the question of corsets, a much discussed
garment. Women who have not been accustomed to wearing corsets
will scarcely feel the need of adopting them during pregnancy except,
perhaps, during the later weeks when the heavy abdomen needs to be
supported for the sake of comfort. This need is felt particularly by
women who have had children and whose abdominal walls are
somewhat weakened in consequence.
If you have been wearing comfortable, well fitting corsets, you
probably will not feel the need of making a change until the third or
fourth month. But by this time the baby will have pushed up out of
the lower pelvis into the abdomen and your corsets then, if you wear
any, must be so constructed that they will not compress nor disguise
your figure, but will provide support and accommodate themselves
to an abdomen that is steadily increasing in size and changing in
shape. Such corsets are made of soft material; have elastic inserts
and have lacings at the sides as well as in the back. They come well
down and fit snugly over the hips. (See Fig. 10.) Some women find
comfort in attaching shoulder straps to their corsets thus suspending
some of the abdominal weight from the shoulders. But as a rule, the
most comfortable arrangement is a short-waisted maternity corset
worn with a brassière that supports the breasts and does not
compress the nipples.
I hope this description will make clear to you why the same style
corsets as you ordinarily wear cannot be satisfactory during
pregnancy, no matter how large they are, and may even prove
harmful.
Your shoes, also, merit some thought, for your feet will probably
be larger during the latter part of pregnancy, partly because of the
possibility of their being somewhat swollen and partly because the
increased weight of your body tends to spread them. This added
weight also increases the strain put upon the arch and as a result,
flat-foot is fairly common among expectant mothers who have not
taken pains to have their arches well supported. Your shoes would
better be an inch longer than those you ordinarily wear; they should
have broad, common sense heels and fit snugly over the instep, in
spite of being full large. If your shoes are not comfortable you will
find yourself tiring easily and for this reason will tend to take less
exercise than you should.
Another reason for the need of proper shoes is that as pregnancy
advances the expectant mother becomes rather unsteady on her feet,
and broad, firm heels help to make her feel more secure. The heels
need not be flat at first, if you have been accustomed to wearing high
ones, for the sudden lowering of the heels may injure your arches,
but as the weeks wear on you would better adopt moderately low
heels. High French heels should be avoided because they not only
increase the difficulty and discomfort of walking but cause backache,
as well, by forcing a position that adds to the pressure on the lower
part of the abdomen. They increase the risk of turning the ankles,
too, and of tripping and falling, which is a very serious accident for
the expectant mother.
Swelling of the feet is very common, and when very slight may
not be serious or particularly uncomfortable. The swelling may be
confined to the back of the ankle, which grows white and shining, or
it may extend all the way up the legs to the thighs. Sitting down, with
the feet resting on a chair, or lying down with the feet elevated on a
pillow will give a certain amount of relief. If the swelling and
discomfort are extreme, the expectant mother may have to go to bed
until they subside, but very often she will be relieved by elevating her
feet or assuming the right-angled position shown in Fig. 14, for even
a little while, several times a day. But while employing these
harmless measures to make yourself comfortable, you must
remember that the swelling of your feet and ankles is one of the
symptoms that your doctor wants to know about. For this reason you
should promptly report to him even the slightest swelling and begin
to measure and save your urine for examination.
Varicose veins are not peculiar to pregnancy but they are among
the pressure symptoms which frequently appear during the later
months, particularly among women who have borne children. The
enlargement of the veins is not usually serious but it may cause a
good deal of discomfort. While varicose veins may occur in the vulva,
they are usually confined to the legs, and both legs are about equally
affected. Sometimes, however, the veins in the right leg are more
distended than those in the left, or the right side alone may be
affected.
Considerable relief may be obtained by keeping off the feet,
particularly by elevating them, and also by the use of elastic
bandages. When an expectant mother finds it difficult or nearly
impossible to sit or lie down for any length of time, she may secure
great relief in a few moments by lying flat on the bed with her legs
extended straight into the air, at right angles to her body, resting
against the wall or head board, as shown in Fig. 14. This right-angled
position for five minutes, three or four times a day, will accomplish
wonders in reducing varicose veins.
A spiral elastic bandage, also, will give comfort and help to prevent
the veins from growing larger, if applied freshly after each time that
the leg is elevated. The most satisfactory bandages, from the
standpoint of expense, comfort and cleanliness, are of stockinette or
of flannel cut on the bias, measuring three or four inches wide and
eight or nine yards long. If made of flannel, the selvages should be
whipped together smoothly so that there is neither ridge nor pucker
at the seam. The bandage should be wrapped around the leg with
firm, even pressure, starting with a few turns over the foot to secure
it, and leaving the heel uncovered, carried up the leg to a point above
the highest swollen vessels. As a rule the bandage may be left off at
night.
There are satisfactory elastic stockings on the market, but they are
fairly expensive, often cannot be washed and seem to offer no
practical advantage over the bandages.
Swollen veins in the vulva may be relieved by lying flat and
elevating the hips, or by lying on the side with the hips elevated on a
pillow for a few moments several times a day, as shown in Fig. 15.
Fig. 15.—Lying on the side with hips elevated to relieve swelling or
varicose veins of the vulva. (By courtesy of the Maternity Centre
Association.)