Python Data Analysis Numpy, Matplotlib and Pandas Bernd Klein instant download
Python Data Analysis Numpy, Matplotlib and Pandas Bernd Klein instant download
https://ebookmeta.com/product/python-data-analysis-numpy-
matplotlib-and-pandas-bernd-klein/
https://ebookmeta.com/product/python-data-analytics-with-pandas-
numpy-and-matplotlib-3rd-edition-fabio-nelli/
https://ebookmeta.com/product/python-data-analytics-with-pandas-
numpy-and-matplotlib-3rd-edition-fabio-nelli-2/
https://ebookmeta.com/product/data-analysis-with-python-
introducing-numpy-pandas-matplotlib-and-essential-elements-of-
python-programming-1st-edition-rituraj-dixit/
https://ebookmeta.com/product/the-medieval-risk-reward-society-
courts-adventure-and-love-in-the-european-middle-ages-1st-
edition-will-hasty/
Restoring Their Trust (The Lost Therian Omega Book 2)
1st Edition Aisling Cousins
https://ebookmeta.com/product/restoring-their-trust-the-lost-
therian-omega-book-2-1st-edition-aisling-cousins/
https://ebookmeta.com/product/first-language-acquisition-3rd-
edition-eve-v-clark/
https://ebookmeta.com/product/challenging-bias-in-forensic-
psychological-assessment-and-testing-glenda-liell/
https://ebookmeta.com/product/android-for-absolute-beginners-
getting-started-with-mobile-apps-development-using-the-android-
java-sdk-1st-edition-grant-allen/
https://ebookmeta.com/product/the-alion-king-1st-edition-milly-
taiden/
Lusam The Dragon Mage Wars Book Three First Edition
Dean Cadman
https://ebookmeta.com/product/lusam-the-dragon-mage-wars-book-
three-first-edition-dean-cadman/
Data
Analysis
by
Bernd Klein
bodenseo
© 2021 Bernd Klein
All rights reserved. No portion of this book may be reproduced or used in any
manner without written permission from the copyright owner.
www.python-course.eu
Python Course
Data Analysis With
Python by Bernd
Klein
Numpy Tutorial ..........................................................................................................................8
Numpy Tutorial: Creating Arrays.............................................................................................17
Data Type Objects, dtype..........................................................................................................36
Numerical Operations on Numpy Arrays.................................................................................48
Numpy Arrays: Concatenating, Flattening and Adding Dimensions .......................................68
Python, Random Numbers and Probability ..............................................................................79
Weighted Probabilities..............................................................................................................90
Synthetical Test Data With Python.........................................................................................119
Numpy: Boolean Indexing......................................................................................................136
Matrix Multiplicaion, Dot and Cross Product ........................................................................143
Reading and Writing Data Files .............................................................................................149
Overview of Matplotlib ..........................................................................................................157
Format Plots............................................................................................................................168
Matplotlib Tutorial..................................................................................................................172
Shading Regions with fill_between() .....................................................................................183
Matplotlib Tutorial: Spines and Ticks ....................................................................................186
Matplotlib Tutorial, Adding Legends and Annotations..........................................................197
Matplotlib Tutorial: Subplots .................................................................................................212
Exercise ....................................................................................................................................44
Exercise ....................................................................................................................................44
Matplotlib Tutorial: Gridspec .................................................................................................239
GridSpec using SubplotSpec ..................................................................................................244
Matplotlib Tutorial: Histograms and Bar Plots ......................................................................248
Matplotlib Tutorial: Contour Plots .........................................................................................268
Introduction into Pandas.........................................................................................................303
Data Structures .......................................................................................................................305
Accessing and Changing values of DataFrames.....................................................................343
Pandas: groupby .....................................................................................................................361
Reading and Writing Data ......................................................................................................380
Dealing with NaN...................................................................................................................394
Binning in Python and Pandas................................................................................................404
Expenses and Income Example ..............................................................................................465
Net Income Method Example.................................................................................................478
3
NUMERICAL PROGRAMMING WITH
PYTHON
Numerical Computing defines an area of computer science and mathematics dealing with algorithms for
numerical approximations of problems from mathematical or numerical analysis, in other words: Algorithms
solving problems involving continuous variables. Numerical analysis is used to solve science and engineering
problems.
Data science is an interdisciplinary subject which includes for example statistics and computer science,
especially programming and problem solving skills. Data Science includes everything which is necessary to
create and prepare data, to manipulate, filter and clense data and to analyse data. Data can be both structured
and unstructured. We could also say Data Science includes all the techniques needed to extract and gain
information and insight from data.
Data Science is an umpbrella term which incorporates data analysis, statistics, machine learning and other
related scientific fields in order to understand and analyze data.
Another term occuring quite often in this context is "Big Data". Big Data is for sure one of the most often used
buzzwords in the software-related marketing world. Marketing managers have found out that using this term
can boost the sales of their products, regardless of the fact if they are really dealing with big data or not. The
term is often used in fuzzy ways.
Big data is data which is too large and complex, so that it is hard for data-processing application software to
deal with them. The problems include capturing and collecting data, data storage, search the data, visualization
of the data, querying, and so on.
• volume:
the sheer amount of data, whether it will be giga-, tera-, peta- or exabytes
• velocity:
the speed of arrival and processing of data
• veracity:
4
uncertainty or imprecision of data
• variety:
the many sources and types of data both structured and unstructured
The big question is how useful Python is for these purposes. If we would only use Python without any special
modules, this language could only poorly perform on the previously mentioned tasks. We will describe the
necessary tools in the following chapter.
5
Numpy is a module which provides the basic data structures,
implementing multi-dimensional arrays and matrices. Besides
that the module supplies the necessary functionalities to create
and manipulate these data structures. SciPy is based on top of
Numpy, i.e. it uses the data structures provided by NumPy. It
extends the capabilities of NumPy with further useful functions
for minimization, regression, Fourier-transformation and many
others.
The principal disadvantage of MATLAB against Python are the costs. Python with NumPy, SciPy, Matplotlib
and Pandas is completely free, whereas MATLAB can be very expensive. "Free" means both "free" as in "free
beer" and "free" as in "freedom"! Even though MATLAB has a huge number of additional toolboxes available,
Python has the advantage that it is a more modern and complete programming language. Python is continually
becoming more powerful by a rapidly growing number of specialized modules.
Python in combination with Numpy, Scipy, Matplotlib and Pandas can be used as a complete replacement for
MATLAB.
6
7
NUMPY TUTORIAL
INTRODUCTION
NumPy is a module for Python. The name is an acronym for
"Numeric Python" or "Numerical Python". It is pronounced
/ˈnʌmpaɪ/ (NUM-py) or less often /ˈnʌmpi (NUM-pee)). It is an
extension module for Python, mostly written in C. This makes
sure that the precompiled mathematical and numerical functions
and functionalities of Numpy guarantee great execution speed.
SciPy (Scientific Python) is often mentioned in the same breath with NumPy. SciPy needs Numpy, as it is
based on the data structures of Numpy and furthermore its basic creation and manipulation functions. It
extends the capabilities of NumPy with further useful functions for minimization, regression, Fourier-
transformation and many others.
Both NumPy and SciPy are not part of a basic Python installation. They have to be installed after the Python
installation. NumPy has to be installed before installing SciPy.
(Comment: The diagram of the image on the right side is the graphical visualisation of a matrix with 14 rows
and 20 columns. It's a so-called Hinton diagram. The size of a square within this diagram corresponds to the
size of the value of the depicted matrix. The colour determines, if the value is positive or negative. In our
example: the colour red denotes negative values and the colour green denotes positive values.)
NumPy is based on two earlier Python modules dealing with arrays. One of these is Numeric. Numeric is like
NumPy a Python module for high-performance, numeric computing, but it is obsolete nowadays. Another
predecessor of NumPy is Numarray, which is a complete rewrite of Numeric but is deprecated as well. NumPy
is a merger of those two, i.e. it is build on the code of Numeric and the features of Numarray.
8
When we say "Core Python", we mean Python without any special modules, i.e. especially without NumPy.
import numpy
But you will hardly ever see this. Numpy is usually renamed to np:
import numpy as np
Our first simple Numpy example deals with temperatures. Given is a list with values, e.g. temperatures in
Celsius:
cvalues = [20.1, 20.8, 21.9, 22.5, 22.7, 22.3, 21.8, 21.2, 20.9, 2
0.1]
C = np.array(cvalues)
print(C)
[20.1 20.8 21.9 22.5 22.7 22.3 21.8 21.2 20.9 20.1]
Let's assume, we want to turn the values into degrees Fahrenheit. This is very easy to accomplish with a
numpy array. The solution to our problem can be achieved by simple scalar multiplication:
print(C * 9 / 5 + 32)
[68.18 69.44 71.42 72.5 72.86 72.14 71.24 70.16 69.62 68.18]
9
The array C has not been changed by this expression:
print(C)
[20.1 20.8 21.9 22.5 22.7 22.3 21.8 21.2 20.9 20.1]
Compared to this, the solution for our Python list looks awkward:
So far, we referred to C as an array. The internal type is "ndarray" or to be even more precise "C is an instance
of the class numpy.ndarray":
type(C)
Output: numpy.ndarray
In the following, we will use the terms "array" and "ndarray" in most cases synonymously.
If you use the jupyter notebook, you might be well advised to include the following line of code to prevent an
external window to pop up and to have your diagram included in the notebook:
%matplotlib inline
The code to generate a plot for our values looks like this:
plt.plot(C)
plt.show()
10
The function plot uses the values of the array C for the values of the ordinate, i.e. the y-axis. The indices of the
array C are taken as values for the abscissa, i.e. the x-axis.
11
To calculate the memory consumption of the list from the above picture, we will use the function getsizeof
from the module sys.
The size of a Python list consists of the general list information, the size needed for the references to the
elements and the size of all the elements of the list. If we apply sys.getsizeof to a list, we get only the size
without the size of the elements. In the previous example, we made the assumption that all the integer
elements of our list have the same size. Of course, this is not valid in general, because memory consumption
will be higher for larger integers.
We will check now, how the memory usage changes, if we add another integer element to the list. We also
look at an empty list:
lst = []
print("Emtpy list size: ", size(lst))
12
Size without the size of the elements: 104
Size of all the elements: 112
Total size of list, including elements: 216
Emtpy list size: 72
We can conclude from this that for every new element, we need another eight bytes for the reference to the
new object. The new integer object itself consumes 28 bytes. The size of a list "lst" without the size of the
elements can be calculated with:
64 + 8 * len(lst)
To get the complete size of an arbitrary list of integers, we have to add the sum of all the sizes of the integers.
We will examine now the memory consumption of a numpy.array. To this purpose, we will have a look at the
implementation in the following picture:
We will create the numpy array of the previous diagram and calculate the memory usage:
We get the memory usage for the general array information by creating an empty array:
e = np.array([])
print(size(e))
96
13
Another Random Scribd Document
with Unrelated Content
proud, sarcastic temper like that of the prince, must have been
peculiarly annoying, the more so as Napoleon, with the gross,
soldier-like want of tact which he would sometimes display, loved to
remind him both of the immensity of the service, and by whom it
had been rendered, and then would laugh coarsely to see him wince
under the reproach, which all his wonted philosophy did not enable
him to bear with calmness.
“He had never the same high opinion of Madame de Staël which
the world professed. He thought her style pedantic and guindé, and
would complain, when any of her compositions were read to him, of
their total want of nature and coloris. I have often heard him say,
that those who read the writings might fairly boast of knowing the
writer, for that nothing could more resemble Madame de Staël
herself than the false, exaggerated sentiments and superficial
erudition of her compositions. I have seldom seen him enjoy more
keenly a story than the one he will sometimes tell of an adventure
which befel Madame de Staël at a party where he himself was
present. I think it was at a fête champêtre given by Madame
Helvetius at her pretty little château at Auteuil. The garden was full
of all the talent of Europe and America combined, for it was just at
the height of the American mania, and the fête, indeed, was given to
the great champion of liberty, the regenerator of his race—l’homme
de la nature—the immortal Franklin. I could tell you, by the bye,
some curious circumstances connected with the great patriot, which
you, as an Englishman, would be glad to hear, and which I am sure
the prince would be equally glad to communicate, for he has but
small esteem for the faux bonhomme, as he called him.
“Madame Helvetius was one of the most charming women that
the world ever produced. The style and type of such beings seem
lost ever since the revolution. Without being strictly handsome, she
always succeeded, without effort, in obtaining more admiration than
the professed beauties who might be in the same company with her.
There was a charm, a grace in every action, in every word she
uttered, which has never been surpassed. Although she herself
possessed no literary talent, there was not a celebrity in Europe who
was not proud of her notice; and her assemblies in Paris, and her
fêtes at Auteuil are not forgotten to this day. Upon the occasion to
which I refer, Madame de Staël was making her début in the Parisian
literary world, and calculating upon even more success than she
obtained, although, had she been a person of moderate pretensions,
she would have been more than satisfied. She had just arrived in
Paris; she herself and all those connected with her, had been bright
particular stars in the somewhat dim and cloudy horizon of Geneva.
“On her first appearance at the réunion, Madame Helvetius had,
of course, with well-bred courtesy, paid her most particular
attention, but having other guests to welcome, had left her after a
while, to superintend the distribution of the amusements about the
grounds. Once or twice she had passed Madame de Staël sitting
gloomily on the bench where she had left her, and at last sent M. de
Talleyrand to keep her company; but M. de Talleyrand had tact
enough to know that, being himself no literary lion, he was no
company for Madame de Staël, and so immediately went in quest of
society more congenial to her taste. He soon returned, in company
with the Abbé Monti, whose poems were at that time the rage all
over Europe, and whose coming put the fair authoress into the best
of humours. M. de Talleyrand sate down on the bench beside them,
in silence, feeling himself quite extinguished by so much talent, and
remained a passive listener, anxious for improvement. The
conversation was overwhelming with erudition, and then the
compliments were poured forth like rain from an April sky,—the Abbé
‘had never reckoned upon so great an honour as that of meeting the
first writer of the age;’ madame ‘little dreamed when she arose that
morning, that the day would be marked by so auspicious an event as
the meeting with the Abbé.’
“‘I have devoured every word that has escaped from Sappho’s
pen,’ said the abbé.
“‘I cannot sleep until I read the charming odes from the Italian
“Tyrtæus,”’ said the lady.
“‘Have you seen my last endeavour?’ said the abbé.
“‘Alas! not yet,’ sighed the lady, ‘although report speaks of it
more highly than of any which have preceded it.’
“‘I have it here!’ exclaimed the abbé, eagerly drawing a small
volume from his pocket. ‘Allow me to present it to you, madame; a
poor homage, indeed, to so much genius, but it may prove
interesting to one who has had so much success in heroic poetry.’
“‘Thanks, thanks,’ cried Madame de Staël, seizing the little
volume with every demonstration of overpowering gratitude. ‘This is
indeed a treasure, and will be prized by me far beyond gold or
jewels.’
“She turned over the leaves slowly, while the delighted abbé
watched her with a charming self-complacency—then suddenly
dropping it into her lap, she exclaimed, turning on the abbé a
languid glance, ‘You were talking of heroic poetry, dear abbé; have
you seen my last attempt—a dramatic scene, “l’Exilé”—a slight and
poor imitation of some of your own?’
“‘I have not been so blessed as to obtain a copy,’ replied the
abbé.
“‘How fortunate that I should have one in my reticule!’ said
madame, hurriedly seizing the strings of the bag suspended from
her arm, and drawing forth a thin volume in boards. The abbé bent
low over it as she presented it, and kissing it with reverence, placed
it by his side, and the conversation—that is to say, the
complimenting—was continued with redoubled vigour.
“M. de Talleyrand then departed, and did not return till the
company broke up, when he found that they had both left the bench
whereon they had been seated so long together, leaving, however,
the ‘precious treasures,’ which they had received from each other
with so much gratitude, behind them! M. de Talleyrand seized upon
them with inexpressible delight, thinking that they would furnish
matter for innocent persiflage, when the loss came to be
remembered by either party. But the thing was complete—they were
never sought and never asked for, and he has them now in his
library, and loves to show them as he tells the story of their coming
into his possession.
“It is in this manner,” said C., as he pulled out his watch,
surprised at the lateness of the hour, “that M. de Talleyrand will
sometimes entertain us with familiar histories of many whom the
world has set upon pedestals of its own erecting, and from which he
is fain to bring them down, although without scorn or malice, in
order that we may see them more closely and know them better.
You will now understand the reason why it must be so difficult to
write a good ‘Life of Prince Talleyrand;’ there would be so little of
himself, compared to what must be told of other people—the work
would be so full of digressions, that it would become as bulky as a
cyclopædia. Besides, a single person could not do the whole. It
would require writers of different talent, of different character, of
different nations—I was almost going to say of different ages—to do
justice to the varied scenes wherein he himself displayed such
variety of talents.”
“Then why do you not, my dear friend, seize upon the branch
which you have at your own disposal, and give the world the Vie
Anecdotique of the prince?” said I. “Supposing you were to begin
and try your skill by relating to me by way of practice before you
publish?”
“Well, well, the idea is not a bad one,” said C., laughing heartily;
“it is certainly not the matériel that would be wanting, and when we
have time and solitude it may amuse us both. One talent at least is
secure, for you are undoubtedly a capital listener.”
CHAPTER VIII.
THE COUNTESS DE LA MOTTE, OF NECKLACE
NOTORIETY.
It will easily be believed that I did not lose sight of the promise
which my friend had made with so much bonhomie, and the very
first time I found myself alone with him, I did not forget to claim it.
The opportunity occurred soon after the conversation I have just
recorded. We were pacing together the long picture-gallery of the
château; the rain was beating in torrents against the Gothic
casements, and all hopes of going abroad had been abandoned. The
prince had not left his chamber that morning. He was busily
engaged, and had announced his intention of remaining invisible
until dinner. He was occupied “à faire son Courier,” as he called it,
upon which occasion I have known him sign and send off an entire
bag full of letters, not one of which was despatched without having
first been carefully perused and corrected by himself. The facility and
precision with which he could always find the exact word which was
needed, and which his secretaries would, perhaps, have been
seeking for some time in vain, was matter of the greatest admiration
to all who witnessed it; but he could neither write nor dictate with
ease; the most trifling petit billet which, when completed, appeared
the very model of graceful laiser-aller and badinage, often gave him
as much trouble to indite as one of his most complicated
despatches.
This, I think, may be attributable to the neglect of his early
education. Subsequent study and careful reading may impart taste
and erudition, but can rarely give facility. C. told me that he has
known the prince remain for more than a week upon the
composition of a letter of condolence or congratulation, if it chanced
to be addressed to a brother wit, or one of whose criticism he might
happen to stand in awe. In these cases, he would cause his
secretary to write two or three letters, in different styles, upon the
subject he had at heart, and would then compile from the number,
one in his own writing, with his own piquant additions and
improvements, which was soon bandied from hand to hand, and
quoted in every salon as a chef-d’œuvre of wit and epigram. Those
who were in the secret would smile at the unbounded praise
bestowed by the journals upon the composition of his despatches
(some of which are really masterpieces), and the wording of his
protocols; for they well knew that they would scarcely have attracted
a single moment’s notice had the truth been known.
“Does he give much time to the writing of his memoirs?” asked I
of C., as he was pacing thoughtfully the polished oaken boards of
the gallery, in which the double line of pictures, which garnish the
walls on either side, is reflected as in a mirror, so that at each step
we seemed to tread upon the semblance of some great king or
warrior; for, with a tacit self-homage, the prince had furnished the
gallery with the portraits of the sovereigns and great men of all
countries, with whom he had come in contact.
“I think his memoirs were concluded some years ago,” replied C.,
in answer to my question, “and that they have been deposited in
safety, out of the pale of his own country, comme de raison, where
they will remain until the time fixed by himself for their publication
shall have expired. Many competent judges are of opinion that, even
at that distant period, the interest of their promulgation to the world
will be but little diminished. There is yet so much mystery, so much
which has been withheld from public scrutiny, in all the great political
changes which have taken place, that there will be as much novelty
in the plain, straight-forward narrative of the causes which led to
their occurrence, as though they were events of yesterday. From the
very first years of the reign of Louis Seize, when the tone and
manners of society yet smacked of the wild and dissolute freedom of
the Regency, to the restraint and affectation of the Restoration, has
M. de Talleyrand always borne a part in public affairs. Always floating
on the tide of circumstance, he has kept himself in full view of the
wondering crowd of beholders, while many of those who had set
forth with better chances of success, by opposing the current, have
been overwhelmed by its resistless rush.
“There cannot exist a greater proof of his cleverness and good
taste, than his steady avoidance of anything like public
condemnation. He has been accused of every crime of which
humanity can be guilty, according to the caprice or fury of his
enemies, but not even a misdemeanour has ever been proved
against him. Even so long ago as when he was as yet, according to
his own expression, ‘un assez mince particulier,’ long before the
revolution, he had tact and sense enough to steer clear of intrigue,
and to avoid the society of those who were suspected of dabbling in
obscure political manœuvre. Indeed, had he not been wise beyond
his years, he could not have escaped intimacy with the Prince-
Cardinal, Louis de Rohan, he who has become famous in history for
his credulity in the affair of the diamond necklace, and who, fool as
he was, has yet been by many historians quoted as the origin, the
first great cause, of the Revolution. This prelate, who at the time
when M. de Talleyrand was a simple abbé, waiting for preferment,
was already at the very acmé of dignity and power, spared no pains
to conciliate the young ecclesiastic. But the Abbé de Perigord was
already possessed of too much discernment not to be fully aware
that these advances were less owing to any merit of his own, than to
the circumstance of his mother being at the time Dame du Palais to
Marie Antoinette, whose good graces it had become a kind of
monomania with the unfortunate cardinal to gain. The prince, to this
very day, however, blesses the good fortune which sent him from
Paris upon business connected with his office as Agent du Clergé,
just at the very moment when the poor befooled cardinal, and his
wily accomplice, were in the very thickest of their plot; so that his
name was never mentioned throughout the whole course of the
proceedings, neither as frequenter of the cardinal’s hôtel, nor even
as an acquaintance of his.”
“Did he ever chance to meet with Madame de la Motte?”
“But once, and that was on the very occasion of his going to
take leave of the cardinal, before he left Paris. He had been invited
to sup with his Eminence, en petit comité, and had come, prepared
to undergo long and ennuyeux discourses upon the various duties of
his new office—the necessity of vigilance in detecting fraud—of
conciliation to prevent discord; in short, he almost dreaded the
interview, fully anticipating the mauvais quart d’heure which is
usually spent by a young, inexperienced priest, when delivered up
defenceless to the torrent of recommendations and warning, of
advice and moral instances, which invariably fall to his share when
alone with his superior. Great, therefore, was the astonishment of
the Abbé de Perigord, when, in spite of the terms in which the
invitation had been couched in the cardinal’s own hand-writing
—‘Venez souper tête-à-tête avec moi’—to find the apartment into
which he was ushered blazing with light, and signs of ceremony and
festivity evident in all the arrangements which had been made for
his reception.
“‘I found,’ said the prince, in whose words I will tell you the
history of this adventure, ‘on entering the petit salon, which was
already lighted with perfumed tapers, and redolent of the fragrant
essences which the cardinal loved so much, seated by the blazing
fire, which was, according to the custom of the Hôtel Cardinal,
composed of scented woods, a lady, whom I instantly recognised as
the Princesse de Guéménée, ex-governess to the royal children, but
who had some time before been compelled to resign office, in
consequence of the disgraceful bankruptcy of her husband, which
had not a little contributed to lower the noblesse in the eyes of the
people, and formed one of the most astounding events by which
that turbulent era was marked. The princess was alone; which
circumstance rather astonished me, for I had come prepared with an
apology for being late, and I wondered at the absence of the
cardinal, as it was already considerably past the time at which he
had requested me to be present. The princess herself seemed
annoyed as I entered. She had evidently been waiting for some
time, for she was in no very pleasant humour, and scarcely deigned
to return a civil acknowledgment to my humble salutations and
inquiries. However, I was easily consoled for any mortification I
might have experienced at this apparent indifference, for the poor
princess had but few ideas to dispense, and I therefore considered
that it might be as a matter of prudence that she hesitated about
wasting them on so humble an individual as myself.
“‘Upon this occasion, I was contented with warming my hands at
the scented blaze, and gazing on the portly form of the princess,
reclining in ample majesty on the green satin fauteuil before me.
Perhaps there never existed a type of ridicule and exaggeration more
strongly defined than the Princesse de Guéménée, particularly at this
period of her life, when, having lost, by extravagance and folly, the
position to which she was entitled by birth and fortune, she
appeared as though seeking to gain distinction in another way, by
exaggerating the follies of the times, and affording in her person a
complete epitome of all the extravagance and bad taste for which
the court had become, even then, proverbial. At the very hour of
which I am speaking, even when under the ban of dismissal from
the court, of reproval from the sovereign, and of the condemnation
of all persons of credit and character throughout the kingdom—when
it was a notorious fact that her husband and herself were paying
loans upon the estates which yet remained to them at the rate of
fifty and seventy per cent.—was she attired in all the absurd and
costly frippery which a depraved fashion might have excused some
years before, when she was yet in possession of the stupendous
fortune which so long had caused the Rohans to rival in splendour
the sovereign himself, but which would only excite pity and disgust
in the minds of those aware of the desperate state of her affairs.
“‘She was attired in a robe of I know not what kind of rich stuff,
which stood on end, and completely filled the immense arm-chair in
which she was seated. This again was entirely covered with the
richest lace, which, looped with ornaments in brilliants, representing
scorpions, fell over either elbow of the chair, completely disguising
its form, thus leaving the princess to represent to the beholder the
richly-decorated joss of some Chinese temple, that scorns, in virtue
of its divinity, the support which mortals need when seated.
Altogether I scarcely ever remember to have seen a more ridiculous
figure than that of the Princesse de Guéménée as she sat thus
before me, the light of the fire dancing upon the diamonds with
which she was covered from head to foot, now resting upon the
thick rouge upon her cheeks, then flying off to some absurd and
comical ornament with which she had thought fit to load the
towering fabric of her powdered hair, and making her countenance
take all kinds of fantastic expressions, as though she had been the
sport of some merry demon.
“‘I endeavoured, as in duty bound, to divert the ennui under
which the princess was labouring, by trying to recount some of the
latest news of the court. I had just returned from Versailles, where I
had spent the day bidding adieu to my friends, and thought that it
might be agreeable to her to hear the newest gossip. But I could
gain no attention. She suffered me to talk on until I was weary, and
I could see that she was not paying the slightest heed to my
endeavours to amuse her. Suddenly, and in the midst of one of my
most diverting anecdotes, she roused herself by a strong effort from
the fit of abstraction into which she had been plunged, and turned
sharply round towards me.
“‘You say you have just returned from Versailles?’
“‘As I have had the honour to tell you, princess.’
“‘Did you hear of my nephew being at court, to-day?’
“‘Indeed I did not hear the cardinal’s name pronounced during
the whole day, although I did not leave until the latest hour of
admission.’
“‘Mon Dieu!’ exclaimed the princess, in a tone of the deepest
emotion, ‘then he has gone thither en secret avec cette intrigante!”
“‘These were her very words, and, just as she had pronounced
them, the rattle of carriage-wheels was heard in the court-yard of
the Hôtel Cardinal, and presently a great noise and bustle were
heard upon the staircase, with loud laughter in a female voice, which
seemed to give a sort of nervous spasm to the poor Princesse de
Guéménée, for she opened and shut the huge fan which she carried,
with a loud, impatient jerk, each time that the echo of that excited
laughter reached the little salon where we were seated. At length,
the door opened, and the cardinal entered, leading by the hand, or
rather, as was the fashion of the time, by the tips of the fingers, a
lady whom he introduced to the princess as the Comtesse de Valois
de la Motte. The name excited my curiosity, for I had heard her story
but a short time before from the lips of my mother, and had been
much moved by her misfortunes. I looked at the lady with the
greatest interest, and with a predetermination to discover traces of
her royal descent in her person and demeanour. I was moreover
wounded by the coldness of the manner of the princess towards her.
I thought her conduct uncivil and inhospitable in the extreme. She
never rose from her chair on the introduction taking place, but had
preserved the same idol-like rigidity of posture, neither did she even
condescend to return a smile in acknowledgment of all the sweet
things with which the Comtesse de la Motte ceased not to
overwhelm her from the first moment of her entrance—assuring her
that she had been longing for this meeting for some time past—that
there was no one in the world whose acquaintance she had so much
desired to make as that of the Princesse de Guéménée—in short, all
the common-place flatteries with which little people are in the habit
of soothing and allaying the adverse tempers of the great.
“‘It is a singular fact (and I do assure you the notion has not
been forced upon my imagination by subsequent events), but I was
struck with the extreme vulgarity of the tone of her address to the
princess, even in the few moments which preceded our summons to
the supper-table; and I had already a certain misgiving about the
character of the lady from this circumstance alone. But I reserved
my definitive judgment of her until we were ushered into the
supper-room, for the petit salon was lighted with lamps of alabaster,
and the light, thus beautifully softened to the eye, was rendered too
dim to enable one to distinguish the play of the features, the
changes of expression, all the little tokens of character which are
exhibited in the countenance when under the influence of any one
predominant passion. I waited then, with patience, until we were
comfortably seated at supper. By good fortune, my place was
opposite to the comtesse, and I was thus enabled to contemplate
her to my heart’s content. It was fortunate, too, that she scarcely
deigned to notice my presence, so absorbed was she in her
endeavours to win a smile from the princess. I was thus rendered a
mere spectator of a scene, which time and the subsequent events
that took place have rendered worthy of being registered among my
own most interesting souvenirs.
“‘As to the cardinal, when once he had apologized to me for his
late return to the hôtel, and excused himself upon the plea of having
been detained at Versailles upon business connected with the affairs
of Madame la Comtesse, he scarcely seemed to remember that I
was in existence, so entirely engrossed was he with the efforts he
was compelled to make, in order to excite the princess to
conversation on the one hand, and to restrain the volubility of the
Comtesse de la Motte on the other. The contrast between the two
female guests of the cardinal was, indeed, striking, and one was led
to wonder at seeing them together at the same table.
“‘You have already heard the description of Madame de
Guéménée: now, Madame de la Motte was, in all points of outward
appearance and manner, exactly the reverse of that mighty dame.
She was a small, lively person, full of fire, and talking with a strong
accent and active gesticulation. She was, without doubt, what, in the
world, is called a pretty woman, for she had a fine complexion, with
sparkling black eyes, and a superb range of ivory teeth, which she
took every pains to display, by an incessant twist of her lips, which I
remember to this day, as having produced the most unpleasant
effect possible upon my nerves. She had a remarkable profusion of
really fine chestnut hair, which was but half-powdered, and clustered
in most bewitching ringlets round her face. Her age might have been
about seven or eight-and-twenty—the very age most to be dreaded
in woman; the mind, possessing all the experience of maturity—the
person yet retaining all the bloom and charm of youth. Her attire
was well chosen to set off her complexion, but it shocked my taste
to witness the profusion of ornament and jewels with which she was
adorned, even while speaking of herself as a pauvre solliciteuse, to
whom a miserly government would only accord a beggarly pension
of eight hundred livres. Her diamonds, indeed, rivalled both in
beauty and profusion those of the Princesse de Guéménée herself,
and her dress consisted of a robe of orange-coloured brocatelle, shot
with black, and flowered with gold. Her hands and arms were hidden
by long gloves of Spanish kid, and I could readily imagine that there
was coquetry in this precaution, as the hardships in which her early
years had been spent, must, of necessity, have left their traces
there.
“‘I remember being struck with the reflection which forced itself
upon me at the time, and being lost in admiration as I gazed upon
the Comtesse de la Motte, at the extreme ease and facility with
which she had acquired the jargon and petty graces of high society.
Her manners certainly gave the lie direct to the old prejudice, that it
requires many years of apprenticeship to become an adept in the
fashionable art. Neither did she betray at first, by any one triviality
or vulgarity of expression or pronunciation, that she had not all her
life been accustomed to the society in which she then found herself.
The only peculiarity which might have excited suspicion in very
particular persons, was the hurry and agitation in which she seemed
to exist—a perpetual restlessness—an over-desire to excite interest
and to produce effect. Mind you, I am speaking of the first hour or
so, while yet she was uncertain as to the opinion which the princess
might have formed of her. But after this restraint had a little worn
off, and she had grown a little less guarded in her conversation, I
began to perceive many incongruities in her behaviour. The effect
was most extraordinary—she appeared, at one and the same
moment, two distinct characters; her very voice altered, sometimes
before she had concluded her sentence.
“‘I must do the Princesse de Guéménée the justice to declare
that, throughout the whole evening, her conduct was perfect. She
listened in silence, but without any evidence of ill-humour or
contempt, to all the agaceries and lively sallies with which the
comtesse sought so earnestly to divert her. She even condescended,
now and then, to applaud, but without favour, and from a distance,
as she would have done from her box at the Opera to the successful
efforts of the actress whose talent might for a moment have
succeeded in charming her into this demonstration of approval. But
it was when, at the solicitation of the cardinal, excited with the wine,
of which she had partaken unsparingly, and elevated by the hope of
winning the good graces of the company, Madame de la Motte
launched forth into the eternal history of her “infortunes,” which had
been her great moyen de succès with the numberless dupes she had
made, that to me all delusion ceased at once. The imposture was
easy to discover beneath the envelope of affected high breeding
with which she had at first concealed her determination of charming
the princess, and the aventurière stood revealed without disguise.
“‘I know that you will suspect my judgment of being influenced
by the conclusion of her story; but I do assure you that even then I
could not help wondering that his Eminence should have admitted to
his intimacy a person like Madame de la Motte. It has since become
matter of surprise to all the world, that the cardinal, credulous and
simple as it had pleased Heaven to make him, could ever have been
so beguiled as to give the slightest degree of credit to her
representations; but as for me, after having passed that single
evening in her company, I almost feel inclined to believe in
witchcraft. There must have been some evil power at work, when
the Cardinal de Rohan was delivered up to the possession (no other
word can express this infatuation) of the Comtesse de Valois de la
Motte!’
“‘How I should have liked to be present!’ said I, ‘and to hear
from her own lips the recital of her adventures!’
“‘Bah!’ said the prince, laughing, ‘I can tell you the tale, and if it
prove as interesting to you as it did to me, you will not forget it
more than I have done. I believe it to be strictly true in all its main
points. It is a singular story, and but little known. She told it well,
too, and I leave you to judge of the effect which it must have
produced at the time.
“‘She said that her father, who, there can be no doubt was, in
reality, the Count de Saint Remy de Valois, descended from Henry
II., had sold the whole of his estates to a rich fermier-général, in
order to satisfy the debts incurred by the inordinate love of
splendour and expense in which his wife had indulged since their
marriage. The family was, in consequence, reduced to the very
lowest ebb of destitution and poverty. The mother, who was the
daughter of one of the Count de Saint Remy’s vassals, had not
strength of mind to bear the poverty which her own extravagance
had brought upon her family, and fled, leaving her husband and
three children to endure the privations which she was so ill-disposed
to share. There was an old Gothic ruin in the park, belonging to
what had once been the château of the Counts de Saint Remy, and
this the fermier-général consented to give up to the count and his
young family. Hither, then, did the hapless little band retire, with no
hope but in Heaven. The count became a confirmed misanthrope,
and never stirred from the old ruin from the moment that he had
fixed his abode within it. He suffered his hair and beard to grow, and
refused to hold communication with any living being, save with his
young children. But he took little heed of their welfare,
notwithstanding his affection for them, nor seemed to care whether
they were provided with bread or left to starve; and, had it not been
for the kindness of the peasants of the neighbourhood, who, with
native delicacy and good feeling, fearing to wound his pride, would
come in secret and at night to deposit provisions upon the threshold
of the mouldering edifice wherein they had taken refuge, the whole
family would sometimes have been for days together without a
morsel of food.
“‘This, however, was far from being sufficient to satisfy their
wants, and the care of providing food devolved, of course, upon the
eldest child Jeanne (Madame de la Motte herself). She would
wander along the public road from sunrise to sunset, holding her
little brother by the hand, and carrying her sister, yet a helpless
infant, on her back, and thus the little trio, faint and weary, and
covered with sordid rags, would run by the side of every carriage
that passed on the highway, calling out in a piteous tone, “Charity,
charity, for the love of God! A morsel of bread for three poor
starving orphans, descended from the royal blood of the Valois!” This
appeal failed not, of course, to attract notice.
“‘I was fair, and pretty,’ said the comtesse, as she told the tale,
‘and sometimes returned laden with silver, which I hastened to
convert into necessaries for our use, and comforts for my father, ere
I sought my home at night. This state of things lasted fur more than
two years. The old ruin had fallen into greater decay; the count had
fallen into a state of greater gloom and apathy, scarcely ever
uttering a syllable to the children, nor seeming to take the least
notice of their departure or return, nor of their efforts to procure for
themselves and him the nourishment which was needful to sustain
existence.
“‘One evening, poor Jeanne returned with her little companions,
weary and footsore, to the old tower. They had been out a longer
time than usual, the day had been wild and stormy, and but few
travellers had passed the road, so that but small profit had been
made, and there was a prospect of a supper even more scanty than
usual. On entering the tower, they were struck by the unwonted
silence and darkness of the place, for the count generally took upon
himself the charge of feeding the fire, and at nightfall lighted a torch
to read over and over again, for the millionth time, the genealogy of
his family, and the title-deeds proving his descent from the Valois,
the only occupation in which he now seemed to find amusement or
consolation.
“‘Upon this occasion, however, all was dark and silent as the
grave, and Jeanne, after having called her father without receiving
any answer, drew near to the hearth, and blew up the few remaining
embers into a sickly blaze, which just sufficed to light the interior of
the tower. Her father was seated, drooping and motionless, in his
customary seat in the chimney corner, leaning against the wall, with
his head bent low upon his bosom, and his hand upon his heart.’
“‘He is asleep,’ said Jeanne, to the little ones; ‘let us make no
noise, but hurry to bed as quickly as possible, that he may not be
disturbed.’
“‘So she gave each of the children a morsel of bread and a piece
of the curd-cheese eaten by the poor peasants in that part of the
country, and they all three sought in haste and silence the bundle of
straw allotted to their use. Here they slept soundly until the dawn.
Jeanne was the first to wake, and, on perceiving the sunbeams
struggling through the loop-hole in the wall, rose with the hope of
having better luck than on the preceding day, and hurriedly gathered
on her rags, determined to set forth at once upon her daily errand.
She was just preparing to rouse her little brother, when she was
struck with terror, on turning to bid adieu to her father, to perceive
that he was still seated in the chimney-nook, in the same attitude in
which she had found him on returning to the tower on the evening
before. He had passed the whole night seated thus without moving;
his head still drooping on his bosom—his hand still pressed upon his
heart! There was something so unnatural in this immobility, that the
child, young as she was, felt overcome with dread. She approached
the count and listened, but she heard not his breathing, nothing but
the beating of her own heart. She laid her hand upon his shoulder,
and pushed him gently.
“‘Father, it is time to rise!’ said she, in a low voice, and then the
loud shriek, which burst from her lips, echoed through the tower,
and roused from their slumber the two babes, who ran crying
towards her.
“‘The body of her father had yielded to her touch, and had sunk
forward into the fire-place, where it lay upon the hearth, among the
cold ashes. It was evident that he had been dead for many hours,
and, in her fright, poor Jeanne, scarcely knowing what to do, seized
the little Marguerite in her arms, and ran screaming from the tower,
nor paused until she reached the town, where instantly, with a
prudence and foresight beyond her years, she went to seek the curé.
Great was the excitement among the peasantry on the estate when
they heard of the death of the Count de St. Remy, and they
assembled in great numbers around the old tower, and bore away
the body to the chapel of the château. But the hard-hearted fermier-
général, well aware that his possession of the estate was illegal—for
the count had not the power to dispose of the land, which belonged
of right to his children after him—refused to receive the corpse, and
it remained for two whole days outside the chapel-door, whence it
was carried to the burying-ground of the village, where it was
thrown without ceremony, still covered with the rags in which he had
died, into the common fosse,—the curé having refused the prayers
of the church to one who had died without its aid, consequently in a
state of impénitence finale.
“‘After the death of her father, Jeanne, still, as usual,
accompanied by her little brother, and carrying her sister on her
back, set off on foot for Paris, with the papers which proved her
descent from Henry II., and which constituted her whole worldly
store, all soiled and ragged, sown up in her tattered casaquin. In this
plight did she traverse the whole of France, a distance of nearly two
hundred leagues, with no support by the way, but from the charity
of travellers, until she arrived at the last stage of her journey, within
one league of the capital. She declared that, on that memorable day,
she had walked more than twenty miles, with the determination of
arriving at Paris before nightfall; but here, just at the very moment
of seeing her hopes realized, she sank exhausted by the roadside,
unable to move a step farther. Her feet were torn and bleeding, and
she was drenched to the skin; the rain, which had fallen in torrents
during the whole afternoon, had rendered the roads so slippery, that
her fatigue had been doubled; added to which, she had scarcely
tasted food since morning, for she discovered that, as she drew
nearer to the capital, travellers were possessed of sterner feelings;
they either turned a deaf ear to her petition, or else laughed to
scorn the terms in which it was couched.
“‘Night was coming on apace; it was impossible to remain till
morning on the wet and muddy bank. Her heart was pierced by the
wailings of her little sister, and the cries of her brother for food and
warmth were most piteous. Once more did she call her courage to
her aid, and essayed to walk, but she was too weak, and, staggering
forward a few paces, fell with her head against a door in the wall,
which ran along the footpath. The shock burst it open, and
discovered to the astonished gaze of the poor famished children, a
scene which appeared to them like fairy-land—a garden filled with
blooming shrubs and flowers, and lighted by myriads of coloured
lamps. There was no one walking in the garden—the ground was too
wet for that—but a few paces from the gate stood a Chinese
pavilion, raised by a flight of steps from the ground, all decorated
with party-coloured streamers, and blazing with light, within which
was gathered a crowd of magnificently-attired ladies and cavaliers,
and whence issued sounds of mirth and laughter, and strains of low
soft music. It was like a dream of heaven! Jeanne never could tell
who among this gay company was the first to perceive the three
little miserable wanderers as they stood shivering at the gate, for
she stood entranced, until she was brought back to reality by a loud
voice shouting a coarse reprimand to a servant in rich livery, who
was standing at the door of the pavilion, for having left the garden-
gate unlocked. Presently the servant in rich livery came hurriedly
down the steps, and taking Jeanne by the arm, was proceeding to
turn her without ceremony into the road, when a sudden instinct
caused her to resist the attack, and springing forward with a
desperate effort, with outstretched arms, she darted towards the
pavilion, and called out in a piteous voice, in which the two younger
children joined, as soon as ever they heard the first note, so familiar
was the cry—“Charity—charity, for the love of Heaven! A morsel of
bread for three poor starving orphans, descendants of the royal
house of Valois!”
“‘In an instant the whole company rushed to the balcony which
surrounded the pavilion, attracted by the piercing shriek of Jeanne
and the novelty of the appeal. She had sunk upon her knees at the
foot of the balustrade, awaiting in silence the success of her bold
attack. For a moment it was doubtful, for the lacquey in rich livery
had again got fast hold of the child’s arm, and in obedience to the
same rough command which had sentenced her to a dismissal
before, was about to push her again towards the gate, when
suddenly a lady, one of the most richly attired among the company,
calling to him in an authoritative tone to desist, and forcing her way
through the crowd, came down the steps to where poor Jeanne was
still kneeling, pale and trembling, with her little brother clinging to
her skirts, and the baby-sister wailing piteously at her back. The
garden where this scene took place belonged to the magnificent
château of M. le Marquis de Boulainvilliers, at Passy; the gentleman
who had commanded the lacquey to turn the children from the gate
was M. de Boulainvilliers himself, and consequently the lady who had
desired him do so at his peril, could be no other than Madame la
Marquise de Boulainvilliers!
“‘The fates had been kind indeed, when they led poor Jeanne
into the friendly domain of the marquise. I knew her well: she was, I
believe, a truly benevolent person, but had perverted her real,
honest, charitable disposition into a sickly sentimentality, by her
intercourse with the Neckers, and her admiration of all the fade
doctrines emanating from the academic grove established at Coppet.
She was, moreover “folle de ce cher Jean Jacques, l’homme de la
Nature, et citoyen de Genève,” and raved about sentiment and
presentiment, and the errors and vices of civilization, and the far
more preferable state of savage life, and “the feelings implanted in
our bosoms by the God of Nature,” &c.; until she, being rather a
portly person, and always overlaced, would sometimes turn suddenly
black in the face, and alarm her auditors by a desperate fit of
coughing, which she owed to her asthma, and which was only
quelled by the exertions of the two tall valets who stood behind her
chair; the one patted her most vigorously on the back, while the
other jerked cold water in her face from a glass ewer, which always
stood ready at hand for the purpose. This is the only remembrance I
have preserved of Madame de Boulainvilliers; but, slight as it is, it
will be quite sufficient to show you all the extent of the good fortune
which had befallen “the descendants of the royal house of Valois.”
“‘The marquise took the poor child by the hand and raised her
from the ground, without any apparent fear lest the contact of such
dirty rags should soil the coloured satin brocade in which she herself
was attired. She spoke to her kindly, and endeavoured to soothe her
agitation, and finally led the whole party into the very midst of the
assembly of dainty ladies and mincing cavaliers, and made them
repeat the extraordinary appeal which had attracted her attention.
Jeanne needed no pressing to induce her to comply with her
request, and the music was hushed and the tittering of the company
silenced by the whining cry, “Charité! charité!—a morsel of bread for
the starving orphans of the royal house of Valois!”
“‘Curiosity was of course excited; the event had given variety to
the amusements of the evening. Madame de Boulainvilliers
questioned the child, who told her history in a plain and artless
manner, and, when she had concluded, drew from the lining of her
casaquin the papers relating to her birth, which Madame la Marquise
read aloud to the astonished assembly. There was a universal
movement in favour of the orphans; a most liberal subscription was
raised on the instant, everybody present proposed assistance in
some way or another to get a placet presented to the king, and so
great was the interest excited, that the worthy marquise hurried
them away to bed, fearing lest some one else might rob her of her
bonne œuvre, by taking charge of the children, concerning whom
she had already formed a multitude of projects in support of her
favourite theory. Here was a fine occasion for displaying the
superiority of the philosophy of Jean Jacques! What good fortune to