Instant data intensive apps with pandas how to manipulate visualize and analyze your data with pandas Hauck instant download
Instant data intensive apps with pandas how to manipulate visualize and analyze your data with pandas Hauck instant download
https://ebookname.com/product/instant-data-intensive-apps-with-
pandas-how-to-manipulate-visualize-and-analyze-your-data-with-
pandas-hauck/
https://ebookname.com/product/programming-skills-for-data-
science-start-writing-code-to-wrangle-analyze-and-visualize-data-
with-r-1st-edition-michael-freeman/
https://ebookname.com/product/programming-sound-with-pure-data-
make-your-apps-come-alive-with-dynamic-audio-1st-edition-tony-
hillerson/
https://ebookname.com/product/mastering-pandas-1st-edition-
anthony/
https://ebookname.com/product/the-black-book-of-training-secrets-
enhanced-edition-christian-thibaudeau/
Practicing Intelligence Providing Support to Combat
Operations 1st Edition Timothy Oliver
https://ebookname.com/product/practicing-intelligence-providing-
support-to-combat-operations-1st-edition-timothy-oliver/
https://ebookname.com/product/comprehensive-vascular-and-
endovascular-surgery-expert-consult-online-and-print-2nd-edition-
john-w-hallett-jr-md-facs/
https://ebookname.com/product/los-pueblos-indi-genas-de-me-xico-
y-sus-derechos-una-breve-mirada-moises-jaime-bailon-corres/
https://ebookname.com/product/culture-and-the-senses-kathryn-
linn-geurts/
https://ebookname.com/product/the-shaolin-monastery-history-
religion-and-the-chinese-martial-arts-1-edition-meir-shahar/
SSM Modern Physics 3e 3rd Edition Raymond A. Serway
https://ebookname.com/product/ssm-modern-physics-3e-3rd-edition-
raymond-a-serway/
Instant Data Intensive
Apps with pandas
How-to
Trent Hauck
BIRMINGHAM - MUMBAI
Instant Data Intensive Apps with pandas
How-to
All rights reserved. No part of this book may be reproduced, stored in a retrieval system,
or transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers
and distributors will be held liable for any damages caused or alleged to be caused directly
or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78216-558-3
www.packtpub.com
Credits
Reviewer Proofreaders
Dan Mantyla Maria Gould
Amy Guest
Acquisition Editor
Akram Hussain Graphics
Ronak Dhruv
Commissioning Editor
Ameya Sawant Production Coordinator
Aditi Gajjar
Technical Editors
Dheera Meril Paul Cover Work
Vrinda Nitesh Bhosale Aditi Gajjar
Prachali Bhiwandker
Copy Editor
Alfida Paiva Cover Image
Sheetal Aute
About the Author
I'd like to thank my friends and family for their support and patience.
About the Reviewer
Dan Mantyla is a HPC Systems Programmer for Atipa Technologies and has been using
Python since 2009. As a utility infielder of all things, software development and with a BSCS
from the University of Kansas, Dan has done everything from contributing to open source
web frameworks to designing advanced cluster management architectures in Python. He
contributes to HPCwire.com and lives in a beautiful Lawrence, KS, home of Linux New
Media and birthplace of Python Django.
www.PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub
files available? You can upgrade to the eBook version at www.PacktPub.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up
for a range of free newsletters and receive exclusive discounts and offers on Packt books
and eBooks.
TM
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can access, read and search across Packt's entire library of books.
Why Subscribe?
ff Fully searchable across every book published by Packt
ff Copy and paste, print and bookmark content
ff On demand and accessible via web browser
Slicing pandas objects explains how to slice the DataFrame. After following the first recipe a
DataFrame can be created, but the next step is understanding how to slice the DataFrame.
Thankfully, it isn't much different from a native Python array.
Subsetting data covers how to select just the data that is of interest, quite often during data
analysis. Cohort analysis is a good consequence of being able to subset data.
Working with dates will cover the beginning of how to carry out date manipulation. Date math
sucks. pandas makes it suck a little less.
Modifying data with functions teaches how to use functions to modify data. Not only is the
analyst often given too much data, but also the data often needs some work and applying
functions to that data can allow for easier use.
Combining datasets discusses how to take multiple datasets and combine them into one,
which is very similar to using SQL to join datasets.
Using indexes to manipulate objects demonstrates the use of indexes for data manipulation.
Index in pandas allows for easy manipulation of data. One way to think about Indexes is that if
data is made up of metrics and dimensions, indexes are the metadata used to describe those
metrics and dimensions.
Preface
Getting data from the Web explains how to get data from the Web. A hidden gem in
pandas is its ability to get data from all over. This brief recipe will show off this feature.
Combining pandas with scikit-learn explores how to integrate pandas with scikit-learn,
a library for Machine Learning. One of the great things about pandas is its ability to work
with other libraries in the PyData ecosystem.
Integrating pandas with statistics packages will discuss integration of pandas, using
StatsModels a module for classical statistics and econometric analysis.
Using Flask for the backend uses Flask. It's a micro framework that allows for quickly
building a web backend.
Visualizing pandas objects will discuss graphing and charting with pandas. Often large
amounts of data can't be understood just by looking at the raw numbers.
Reporting with pandas objects puts it all together. Using Flask as the backend, the
reader will build a basic reporting app to display a subset of a DataFrame.
ff Numpy
ff SciKit Learn
ff StatsModels
ff Flask
ff matplotlib
ff IPython (not technically required, but highly recommended)
2
Preface
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of
information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames,
dummy URLs, user input, and Twitter handles are shown as follows: "Create an incredibly simple
DataFrame to start."
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or may have disliked. Reader feedback is important for us to develop
titles that you really get the most out of.
If there is a topic that you have expertise in and you are interested in either writing or
contributing to a book, see our author guide on www.packtpub.com/authors.
3
Preface
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you
to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen.
If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be
grateful if you would report this to us. By doing so, you can save other readers from frustration
and help us improve subsequent versions of this book. If you find any errata, please report them
by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on
the errata submission form link, and entering the details of your errata. Once your errata are
verified, your submission will be accepted and the errata will be uploaded on our website, or
added to any list of existing errata, under the Errata section of that title. Any existing errata can
be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At
Packt, we take the protection of our copyright and licenses very seriously. If you come
across any illegal copies of our works, in any form, on the Internet, please provide us
with the location address or website name immediately so that we can pursue a remedy.
We appreciate your help in protecting our authors, and our ability to bring you
valuable content.
Questions
You can contact us at questions@packtpub.com if you are having a problem
with any aspect of the book, and we will do our best to address it.
4
Instant Data-intensive
Apps with pandas
How-to
Welcome to Instant Data Intensive Apps with pandas How-to. This book is a collection of
recipes with the intention of transforming the reader from being a novice with just a simple
idea of what pandas is, to a highly efficient user of the library. This book is not meant to be
a comprehensive look through all the nooks of pandas, but is meant to get the reader up
speed in the most common tasks.
Getting ready
Most of the rest of the book is working with data once it's in a pandas data structure, but this
recipe is about those structures themselves and getting data in and out of them. Open your
interpreter, preferably IPython.
Instant Data-intensive Apps with pandas How-to
How to do it...
1. Create an incredibly simple DataFrame to start with. A DataFrame can handle lists,
NumPy arrays, dicts of strings, and more.
> import pandas as pd
#standard convention throughout the book
> import numpy as np
> my_df = pd.DataFrame([1,2,3])
> my_df
0
0 1
1 2
2 3
2. The first example is too simple, and isn't useful. Add some column headers and index
for more information about the DataFrame.
> cols = ['A', 'B']
> idx = pd.Index(list('name'), name='a')
> data = np.random.normal(10, 1, (4, 2))
> df = pd.DataFrame(data, columns=cols, index=idx)
df
A B
a
n 9.945858 10.607128
a 10.742073 8.968044
m 10.178861 7.293450
e 10.251922 10.657038
6
Instant Data-intensive Apps with pandas How-to
<class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 4 (major_axis) x 2 (minor_axis)
Items axis: df1 to df2
Major_axis axis: n to e
Minor_axis axis: A to B
3. There are many ways to do I/O with pandas; in this step we will write the DataFrame
out to several mediums.
#write df to different file types
> df.to_csv('df.csv')
> df.to_latex('df.tex') #useful with Pweave
> df.to_excel('df.xlsx') #requires extra packages
> df.to_html('df.html')
> df.to_string()
' A B\na \na 9.945858
10.607128\nb 10.742073 8.968044\nc 10.178861 7.293450\nd
10.251922 10.657038'
> pd.read_csv('df.csv')
7
Instant Data-intensive Apps with pandas How-to
How it works...
Most of the file input and output in pandas is the orchestration behind the scenes of
formatting the value outputs, and then writing those values to a file. There are many
options for formatting file output. The to_csv method takes many parameters. Some
of the more common parameters are as follows:
The following snippet writes the DataFrame df and writes it to a file called file.tsv,
and it's formatted according to the parameters passed to the method.
> df.to_csv('file.tsv', sep='\t', index=False, na_rep='NULL')
There's more...
In addition to standard file input and output functionalities, pandas has several built-in niceties.
Besides the parsing capabilities, pandas also has a very handy date_range function,
which returns a range of dates determined by the inputs. For example, it's very easy to
get the months of 2012 in a series. This is shown in the following command line:
> pd.date_range('2012-01-01', '2012-12-31', freq='M')
> df = pd.read_csv(url)
8
Instant Data-intensive Apps with pandas How-to
Getting ready
Open up your interpreter, and execute the following steps:
How to do it...
1. Create a simple DataFrame to explore the different slicing abilities of pandas.
> dim = (10, 3)
> df = pd.DataFrame(np.random.normal(0, 1, dim), columns ['one',
'two', 'three'])
6. Use the head and tail functions to easily select the top and bottom of the
DataFrame.
> df.head(2)
one two
0 -0.492156 1.978798
1 -0.476418 -0.225360
9
Instant Data-intensive Apps with pandas How-to
How it works...
At some level, pandas objects behave similar to NumPy arrays; they are after all abstractions
built on top of them. However, because we have more metadata about the data structures we
can use that to our advantage.
After the initial pandas object is created, simple slicing occurs according to the
following structure:
> df[column names][rows]
Here column names is a string (or an array, if multiple columns) and rows is the number of
rows that we wish to use.
There's more...
The methods that have already been described are very useful at a higher level, but there are
more granular operations available.
Getting ready
Open up your interpreter and follow along with the interpreter's session in the following How to
do it… section.
10
Instant Data-intensive Apps with pandas How-to
How to do it...
1. Create a sample DataFrame df to manipulate.
> d = {'Cost': np.random.normal(100, 5, 100),
'Profit': np.random.normal(50, 5, 100),
'CatA': np.random.choice(['a', 'b', 'c'], 100),
'CatB': np.random.choice(['e', 'f', 'g'], 100)}
> df = pd.DataFrame(d)
2. Pass a Boolean value to the DataFrame to select only those rows that evaluate to True.
> df[df.CatA == 'a'][:5]
CatA CatB Cost Profit
0 a g 102.716045 48.585048
1 a g 103.342873 44.285223
3 a f 100.563783 52.609880
4 a f 92.057118 53.030021
10 a f 97.494169 44.849129
11
Instant Data-intensive Apps with pandas How-to
How it works...
Subsetting is an integral part of data analysis, and is very simple to do in pandas. A nice
pattern for creating subsets is to create mask arrays, which are arrays of Booleans, and
then passing those into the DataFrame. For example, executing df[df.CatA.isin(a_e)]
in the interpreter will return an array of the same length as df.CatA.
There's more...
There are more powerful pandas functions that make selecting subsets of DataFrames
more concise.
Getting ready
Open up your interpreter and follow the command progression in the following section.
Difficult financial analysis was the mother of pandas creation; therefore, it has many efficient
and easy ways for dealing with dates.
How to do it...
1. Let's examine the date_range functionality within pandas.
> Y2K = pd.date_range('2000-01-01', '2000-12-31')
> Y2K
12
Instant Data-intensive Apps with pandas How-to
class 'pandas.tseries.index.DatetimeIndex'>
[2000-01-01 00:00:00, ..., 2000-12-31 00:00:00]
Length: 366, Freq: D, Timezone: None
> Y2K_temp['2000-01-01':'2000-01-02']
2000-01-01 77.425233
2000-01-02 67.949946
Freq: D
13
Instant Data-intensive Apps with pandas How-to
How it works...
The date_range function is defined by dates and frequencies. See the following section for
the various frequency designations. The easiest way is to define a start date, end date, and
frequency, but there are other ways as well. You can also change the frequency, or resample
to a smaller or larger time interval.
There's more...
pandas adds a lot more functionalities to handle dates. These are mostly convenient methods
because working with dates is a necessary evil of data analysis.
s.resample('M', how='sum')
In the preceding example, the 'M' variable specifies that we're upsampling to month.
Downsampling is also done in a similar way; however, pandas provides functionalities for
handling the disaggregation in a convenient way.
Getting ready
Open up your interpreter, and type the following commands successively.
14
Instant Data-intensive Apps with pandas How-to
How to do it...
1. Create a simple Series of simulated open and close for a year.
> data = {'Open': np.random.normal(100, 5, 366),
'Close': np.random.normal(100, 5, 366)}
> df = pd.DataFrame(data)
> df
<class 'pandas.core.frame.DataFrame'>
Int64Index: 366 entries, 0 to 365
Data columns:
Close 366 non-null values
Open 366 non-null values
dtypes: float64(2)
15
Instant Data-intensive Apps with pandas How-to
> df.apply(np.mean, axis=0)
Close 99.739967
Open 99.631989
3. Define a standalone function that takes two arguments. One is the element itself,
and another argument.
> def greater_than_x(element, x):
return element > x
> df.Open[mask].head()
1 100.713672
3 105.492173
4 100.171148
6 104.810547
7 110.539181
Name: Open
16
Exploring the Variety of Random
Documents with Different Content
of the hour, which were never to be realised, was a projected visit to
the Holy Land. She would so like to see the holy places!
"The wildest scheme!" young Del Vasto pronounced it, when a
rumour of it reached him at Rome. He lost no time in hastening to
his beloved friend, to dissuade her from what she had perhaps never
seriously contemplated, and to induce her to be content with the
Eternal City. And when she reached it, she was received with almost
public honours—so proud was Italy of its "divine Vittoria Colonna!"
Here she found a circle of the most eminent men in Italy, hopefully
awaiting the issue of Cardinal Contarini's conciliatory mission to the
German Reformers; and it was trusted that, by wise concessions on
the part of Rome, a fearful schism might be avoided. But when did
Rome ever make wise concessions?
It was at this time that the friendship commenced between Vittoria
and Michael Angelo, which was equally honourable to both; and we
have his own word for it, that through her he was made a devout
Christian. It was the crowning beauty of her life.
Meanwhile Giulia was the prey of intense melancholy at Fondi. It
expressed itself in joyless looks, in mournful tones, in neglected
dress, in small austerities, in rising at out-of-the-way hours to tell
her rosary, &c.
Her ladies united in declaring that she must be ill, and that the
marsh miasma was answerable for it. So then Bar Hhasdai was sent
for; and he advised change of air and quantum sufficit of generous
red wine well spiced. She acquiesced in both prescriptions; and then
indulged in a little doctors' gossip, that most healing balm. They
talked over the Cardinal's death, and Bar Hhasdai said that, even if
he had been sooner sent for, he did not believe he could have saved
him.
"One cardinal the less, one saint the more," said Giulia.
Bar Hhasdai looked sceptical. "Was he of the stuff that saints are
made of?" said he.
"He was very generally liked," said Giulia.
"And so long as thou doest good unto thyself, men will speak well of
thee," said the Jew, equivocally.
So she returned to her old quarters at Naples, where she had the
satisfaction of hearing from Valdés, who immediately waited on her,
that Ochino was again preaching with great acceptance. She had
tried ascetic mortifications, on a small scale, without any beneficial
result; and she now, with a heart aching for a better life, and sick of
the world's pleasures, which, after all, she had never much indulged
in, resolved to prove whether enduring comfort might not be derived
from the cross of Christ.
CHAPTER XVIII.
A BETTER LIFE.
You may have seen an old print of Titus's Arch, in the foreground of
which is an Italian lady of quality, with hoop, lappets, and fan,
sailing to church, attended by her gentleman-usher. A stately man-
servant in advance clears the way, two ladies-in-waiting follow their
mistress at a respectful distance, and two or three more menials
close the procession.
Something in this style did Giulia go to the cathedral. As she was
returning from it one evening, accompanied by Valdés, her heart
was full, and, after one or two ineffectual beginnings she said—[15]
[15] Vide "Alfabeto Christiano."
"I have so much confidence in our friendship, Signor Valdés, that I
feel as if I could speak to you on some subjects even more freely
than to a confessor. If you are not pre-engaged, therefore, I would
gladly tell you what is on my mind. Do I importune you?"
"On the contrary, Signora," said Valdés, "I am honoured by your
commands, and you well know there is no one I love better to
serve."
"A truce, then, with compliments of every kind. I want to open to
you my whole heart, for I am sure you will pity me. I am a prey to
such constant dissatisfaction with myself and with everything around
me, as cannot be described. I neither know what I wish, nor with
what I should be contented. Hence, I cannot conceive anything that
could be offered me capable of appeasing this inquietude and
removing my confusion of mind. Many years have I felt thus: and of
late you have given me reason to hope that if I would give ear to the
preaching of Ochino I should be tranquillised. Alas, I find it quite
otherwise! And though I admit that the fault may be mine rather
than his, yet the disappointment is so bitter, that tears frequently
come into my eyes through not knowing what to do with myself, nor
what to lean upon."
Saying which, her tone was so sad, and she looked so troubled, that
the humane Valdés was filled with compassion.
"Say freely, Signora," said he, "whatever you wish to ask of me; and
be assured that I will always expend in your service all that I know
and am able to do."
"Tell me, then," said Giulia, "from what cause you believe this state
of mind to spring, and how, if possible, it can be remedied, or
whether it must be borne."
"You must first make me one promise," said Valdés.
"What can that be?" inquired the Duchess.
"If I show you the way by which you may be relieved from your
disquietude, you must promise to walk in it."
"Of course. Gladly!"
"Be very attentive, then, Signora, to what I am about to say. You
know it is written that man is made 'in the image and likeness of
God.' And you will also remember that St. Paul counsels the
Corinthians to put off the old man with his deeds, that is, the sinful
nature we have all inherited since the fall, and be clothed with the
new man, who is created 'in the image and likeness of God.' From
this it appears, that in such a degree as man retains in himself the
image and likeness of God, in the same degree he apprehends and
appreciates spiritual things in a spiritual life and conversation.
Recognise this, and you will all at once perceive whence your
disorder and disquietude of mind arise; because you will see that
your soul is striving for restitution to the image of God, of which at
present it is deprived. The remedy is in your own hands."
"In my hands?"
"Yes! Because as soon as you determine to renew and restore within
yourself the image and likeness of God, you will find peace, quiet,
and repose."
Giulia drew a deep breath, and then said—
"How must I do this?"
"By withdrawing your affections from vain and transitory things, and
fixing them on those which are spiritual and eternal. Your spirit thus
finding its proper aliment, will always be content and cheerful, and
here in this present life will begin to taste of that felicity which it
expects to enjoy for ever in the life eternal. To this happiness only
the real Christian can attain."
"As for that," said the Duchess, "I know many persons who have as
much, and perhaps more, cancelled the image of God than I have,
who are yet perfectly content and happy."
"Such persons," returned Valdés, "have low and vulgar minds, and
can therefore suffice themselves with mean and frivolous objects
that could never satisfy a refined and generous nature like yours.... I
am not at all sorry that you should be troubled in the way you have
described, because it shows that the preaching of the Gospel is
producing its first effect on you.... There is nothing in this world that
could give me so much pleasure as to see you walking in the path of
life, for I hold it for certain that, once in complete union with God,
you would outstrip many who are now saints in heaven."
"I desire to do so," said she, softly.
"Then why don't you do what you desire?" rejoined Valdés.
"Because I don't know how."
"Force, force, Signora! force is the one thing wanting. 'The kingdom
of heaven suffereth violence, and the violent take it by force.'"
"Lead me by the hand, then," said she, "instructing me in those
footsteps by which I believe you have walked."
"You want me," said Valdés, "to show you some royal and ladylike
road by which you may get to God without turning away from the
world. But, lady, no such compromise can be made. Have you ever
crossed a running stream?"
"Yes, many times."
"Do you not remember how your head swam if you looked at the
flowing water, but how steady it was if you fixed your eyes on the
opposite shore? Thus, with God and the world, endeavour to keep
the view of your soul fixed and nailed with Christ on the cross. And if
at any time, through want of care, your eyes are diverted to the
things of this world, return, return, Signora, as quickly as possible,
to fix them on Christ crucified; and all will be well. You know the
human heart is naturally inclined to love. It must either love God and
all things for God, or it must love itself and all things for itself. He
who loves God, performs everything he does for Him. And thus, if he
loves anything besides God, he loves it for the sake of God, and
because God wills it so. And then his good works please and are
acceptable to God, because they spring from love. Agreeable to this
is what St. Augustine says—'Good works follow in them who are
already justified, and do not go before in him who has to be
justified.' You know how you yourself estimate what a person does
in your affairs when you know you owe not his good services to the
affection he bears you, but to some other motive."
This dialogue, which had been begun in the open air, was now being
carried on in the Duchess's parlour. She sat in a high-backed, richly
carved chair, looking out through the balconied window, on the bay
of Naples, with streaks of summer lightning now and then illumining
the sky, and the lurid fires of Vesuvius glowing in the distance.
Valdés sat on a stool a little apart.
"Since you wish me," said she, after a pause, "to make the love of
God my prime motive, and, next to it, the love of my neighbour,—
well then, I will do so!—but mention, if it please you, some rule by
which I may know and understand what it is I ought to do; because
I wish to give myself up to the love of God, even so much so as to
deprive myself of your favour, and that of a hundred others like
you."
"No, Signora, no! you can never do that!" said Valdés, fervently: and
he then sketched out for her the outline of a Christian life, not
circumscribed within slavish bounds, but capable of adaptation to
time and place, sex and degree, based only on the immutable
principle of loving God above and in all things, and one's neighbour
even as one's self. It was a memorable evening for Giulia. Her
cheeks were wet with tears, but they were the sweetest she had
ever shed. They took no note of time, but prolonged the interview
till night.
When they parted, she said to him:
"I shall never forget this conversation!"
"And I," said he, deeply moved, "shall remember it always."
"Oh, that I could preserve every word you have spoken! Do you
think you could commit the substance to writing?"
"Undoubtedly, if you wish it."
"I do wish it, most earnestly. And pray for me, pray for me, dear
friend, that your words may not only sink into my heart, but take
root in it, and bring forth fruit abundantly."
"I will, indeed, Signora; but, above all, fail not to pray for yourself,
that the love of God may abound in you yet more and more."
"Never knew I till now what that love was! I have heard tell a
thousand times of this going out of a person's self to enter into God,
but never, in all I have heard, was it made comprehensible."
"You are so much the more under obligation to love God, since He
has preserved you so long in this world as to come to know this
which till now you have not understood."
"You are right. May it please God that I know how to profit by it."
She gave him her hand. He kissed it with the utmost reverence:
then, raising his eyes heavenwards, uttered a short, fervent prayer
for her confirmation in the knowledge and love of God.
When he was gone, she covered her eyes with her hand, and tears
slowly trickled down her cheeks. Almost unconsciously, she sank on
her knees and murmured——
"O, my God! teach me to be what Thou wouldst have me to be, and
then enable me to do what Thou wouldst have me to do! Form in
me Thine own image and likeness, for Christ's sake!"
A strange calm and sweet peace took possession of her soul.
When Valdés presented himself to her, a few days afterwards, he
brought her his manuscript version of the substance of their
dialogue, written in his native Spanish, which was nearly as familiar
to her as Italian, seeing that it was continually spoken by Vittoria
Colonna and others of her familiar acquaintance. The faithfulness
with which he had recalled the vivacity of her rejoinders showed how
deeply they had interested him, and if his own speeches were less
closely reported, it was chiefly because he had taken the opportunity
of extending them even at the price of weakening their spirit.
"Here," said he, "you have what you required of me; and I have
called it the Christian Alphabet, because, in fact, it contains but the
A B C of Christian doctrine. Believe in nothing I have here set down
that you cannot bring to the test of Scripture. And do not content
yourself with this Alphabet, or with any mere writings of men, but
drink of the pure water of life at its source. May Christ become the
peaceful possessor of your heart, in such a manner as that He may
absolutely and without contradiction rule and regulate all your
purposes. When this is the case, you will not feel the want of
anything whatsoever in this life to give you contentment and
repose."
She took the book with solemnity, and promised compliance with his
wishes. This singular little work, of which, till lately, it was not known
that there was a copy extant, does not profess to be more than what
Valdés called it, and confines itself to inculcating the formation of the
Divine image in the soul, if haply it might find Him, without
attempting to attack the prevailing corruptions of the Church. In
fact, this remarkable layman, who set so many Reformers forward
on the path of martyrdom, did so by inculcating a few great truths,
rather than by pulling down strongholds of error; and a certain class
of his disciples eventually brought discredit on him by veiling
Reformed opinions under the punctilious observance of Romish
practices. But not of these temporising spirits were Carnesecchi,
Flaminio, or Vergerio; all of whom were of the school of Valdés.
CHAPTER XIX.
REST AND PEACE.
When the structure is built, the scaffolding is removed: when we are
raised up to Christ, our earthly props are often knocked away.
Ochino was soon to leave Naples—Valdés was soon to leave this
earthly world. For a little while the Church had rest: and then burst
out a furious, fiery persecution. Its burning annals have no place in
my story; but I will annex a chapter about it as an Appendix, for
those who will not or cannot refer to the original sources.
An advance had taken place in Ochino's opinions, which, for a time,
was felt rather than understood by his hearers. He appealed directly
to the Scriptures in support of his doctrine, and bade them search
for themselves. In spite of his boldness, he not only was allowed to
continue to preach in the Cathedral, but, in a chapter held at Naples
in 1541, was re-elected General of the Capuchins.
His departure from the Church of Rome was detected, however, by
the jealous eye of Cardinal Pole, who wrote to Vittoria Colonna,
urging her to beware of his influence, and even exacting from her a
promise, which no woman of independent spirit would have given,
that she would not read any letter addressed to her by Ochino,
without consulting him or Cardinal Cervini. Vittoria gave this
promise, and afterwards redeemed it by transmitting to Cardinal
Cervini, not one letter, but a packet of letters written to her by
Ochino; observing on them, in an accompanying note, "I am grieved
to see that the more he attempts to excuse himself, he condemns
himself the more; and the more he believes he shall save others
from shipwreck, the more he exposes himself to the deluge; being
out of the ark which alone can save."
Vittoria was at Rome, the head-quarters of intolerance, attending Fra
Ambrogio's lectures in the church of San Silvestro, and sending her
servant, after the sermon, to Michael Angelo, saying, "Tell him that I
and Messer Lattanzio are here in this cool chapel, that the church is
shut and very pleasant, and ask him if he will come and spend the
morning with us." And when he came, their talk was not of polemics,
but of painting, and of her building a convent on the slope of Monte
Cavallo.
Vittoria, having put her hand to the plough, had drawn back; but
Giulia had chosen the better part, and has attained the honour of
being stigmatised in Romish records as "suspected of heretical
pravity."
Oh! how she wept when Valdés died! They were tears of sweet and
pure affection, unmixed with bitterness or gloomy foreboding, for he
had been called, at the second watch, to his rest: and she had now
a good assurance of following in the same luminous track, upheld by
the same right hand, straight up to heaven, without the intervention
of a fearful purgatory.
He was called away in the strength of his manhood, for he was little
more than forty, and his twin brother is lost sight of about the same
time. Lovely in their lives, in death they were not long divided.
Peaceful, natural decline removed them from the persecutions that
awaited their followers.
It is not hard to divine his last admonitions to Giulia. "Search the
Scriptures, for in them we know that we have eternal life. Pray, dear
Signora! pray! As our Lord prayed on the mount, the fashion of His
countenance was altered, and His raiment became white and
glistening! Doubtless, whenever we pray, the expression of our
countenance is altered in the sight of God, if not of man; and our
raiment, the righteousness of Christ, becomes white and glistening.
Oh, what an incentive to prayer! St. Matthew and St. Luke, you will
find, in narrating the transfiguration, do not give us the preface
—'and as he prayed.' But how important an addition it is! What a
blessing that prayer drew down! It drew prophets and saints from
heaven!"
"Valdés, dear friend! Would that my prayers might hereafter draw
you down from heaven to comfort me! Yet no; I recall the selfish
wish. Rather let me fancy you calling, 'Come up hither!'"
"Fancy our Lord so calling you, dear Signora, and it will be mere
fancy no longer. All my teaching will have been in vain, if you covet
human rather than divine sympathy and help."
"But you have been to me as a brother."
"There is a Friend that sticketh closer than a brother, Signora. Come,
give me a text, ere you leave me, to dwell upon when you are
gone."
"'Ye shall go out with joy, and be led forth with peace.'"
"God grant it! And here is one for you, whose time has not yet come
to be led forth. 'Behold! I have refined thee, but not with silver'—
(not in the same way, that is; not with mere physical heat)—'I have
chosen thee in the furnace of affliction.' See! there is something that
escapes us at first. God not only says He has tested us, but that He
has chosen us. O, blessed to be the chosen of the Lord——"
"Valdés, I seek Him, but I know not that I have yet found Him——"
"Signora! 'let the heart of them rejoice that seek the Lord.'"
While masses were being sung and said for the soul of Cardinal
Ippolito, the spirit of Valdés departed without a sigh. "For so He
giveth His beloved sleep." But were Giulia's affections, which had
been gradually refining, then left without a human object? No. By
the will of his paternal grandfather, her nephew, Vespasiano, the
little Duke of Sabionetta, came into her charge; and the education of
the dear little boy, now eight years old, became her care. She
procured the best and most enlightened tutors for him, in Tuscan,
Latin, and Greek; and despatched an envoy to Charles the Fifth, to
secure for him the investiture of the state of Lombardy, and to
supersede its administrators by Don Ferrante and Cardinal Ercole
Gonzaga.
This young boy was trained up by her in the paths of virtue and
godliness; and lovingly did he repay her pains. He grew up a fine
character, distinguished for liberality and intelligence; and to him the
Jews owed the licence for their printing press at Sabionetta. When
he died, in 1591, the line became extinct.
Besides superintending Vespasiano's education, the Duchess devoted
herself to visiting the sick in the hospitals, and relieving the poor
with her own hands. She shunned the company of the idle and
frivolous, and cultivated the friendship of the wise and good. She
lived to a ripe old age, shining more and more unto the perfect day
—a light in a dark place, during an age of gross corruption—
unsullied by the breath of slander, and respected, in spite of her
averred 'heretical pravity,' by the Romish Church.
The faithful old maggior-domo, Perez, wrote thus to Vespasiano, on
the 19th of April, 1566:
Martyrs of whom the world was not worthy! It is less sad, after all,
to read of the martyrdoms of Carnesecchi, and Di Monti, and
Paleario, and many others, than to find heresies and schisms
creeping into the little flock itself, and drawing many of them away
from the purity of that faith for which others died.
Unitarianism was the canker that ate into the bud of the Italian
Reformation. The opinions of Servetus and Socinus, and various
modifications of them, insinuated themselves into the minds of the
hapless exiles, who were scattered as sheep having no shepherd.
Camillo Renato was one of the leading schismatics; and though he
did not avow his own disbelief in the Trinity, his followers made no
scruple of doing so. Many were tossed in a wild sea of doubt; others
were swayed to and fro by every wind of doctrine; but we must not
forget that a great many were consistent and faithful to the end of
their course. Even Ochino's orthodoxy was suspected; though Calvin
saw no reason to doubt it. There was a cloud, however, over his
latter days.
Pius the Fourth was of a mild disposition, but he was not powerful
enough to overrule the inquisitors. A house beyond the Tiber was
appropriated to them, to which cells were added for criminals, or
those who were accounted such. This was called "the Lutheran
prison," and it was said to be built on the site of the ancient Circus
of Nero, in which so many Christians were delivered to the wild
beasts.
The persecution raged with redoubled fury under Pius the Fifth:
especially at Bologna, where "persons of all ranks were
indiscriminately subjected to the same imprisonment, tortures, and
death. In Rome, some were every day burnt, hanged, or beheaded;
all the prisons were filled, and they were obliged to seek new ones."
Think of the constancy of these confessors! Rome had no need to go
to Japan for martyrs. If she should hereafter have a Protestant
martyrology, many of her own sons and daughters may be enrolled
in it. "We know not what becomes of people here," wrote Muretus to
De Thou; "I am terrified every morning when I rise, lest I should be
told that such and such a one is no more: and if it should be so, we
should not dare to say a word."
And thus the Italian Reformation was crushed out! But its motto is
"Resurgam!"
II.
"The 'Alfabeto Christiano' is a book unknown even to bibliographers
for the last three centuries. It had its origin in an actual conversation
between Juan de Valdés, twin brother to the Latin secretary of the
Emperor Charles the Fifth, and Giulia Gonzaga, Duchess of Trajetto
and Countess of Fondi, at Naples, about the close of 1535, or the
beginning of the following year. At her request it was immediately
afterwards written down by him in Spanish, to promote her
instruction and refresh her memory. It now essentially conveys to us
the spirit and substance of the conversation in the precise form and
manner in which it took place between them."—Introduction by
Benjamin B. Wiffen, Esq., to his translation of the "Alfabeto
Christiano."
"It was printed at a time when for a few years the press of Venice
was comparatively free; and when, taking advantage of this liberty,
then existing nowhere else in Italy, it multiplied the tracts of the
Reformation by thousands. When the friends of Valdés were
afterwards persecuted at Naples, and his name condemned by the
authority of Rome, implicating by connection with him, one of the
most distinguished members of the noble family of the Gonzagas,—
all parties, friends equally with opponents, would of course be
concerned to observe silence on the subject; while all the friends of
the family would be urged alike by religious sentiment and by family
considerations to destroy silently and irrecoverably every copy of a
book that appeared to cast, by its association with her name, the
shadow of its principles upon those who were allied to her."—Ibid.
The passage describing the manner in which a stray copy fell into his
hands, and the circumstances under which he perused it, is one of
the pleasantest in Mr. Wiffen's Introduction. McCrie quotes a passage
from Fontaine, who tells us that "on taking down an old house at
Urbino, in 1728, the workmen disinterred a copy of Bruccioli's
'Paraphrase of St. Paul's Epistles,' with some books of Ochino,
Valdés, and others of the same kind, which had remained in
concealment for more than a century and a half."
III.
"Carnesecchi was secretary to Clement the Seventh, and afterwards
prothonotary to the Apostolic See. One of his preferments was an
abbey at Naples.... After the death of Clement, he retired from the
Roman court to Naples, where he became intimate with Juan de
Valdés. He was in that city in December, 1540, when Valdés died;
and if he did not himself receive his last confession, which is very
probable, he at least knew what it was, for his commendation of it
formed part of the accusation against him on his trial in 1567, before
the Inquisition at Rome; and after the death of Valdés he succeeded
to the confidence of Giulia Gonzaga. This correspondence brought
her also under the suspicion of the Inquisition on two occasions;
once in 1545, and again, a short time before her death, in 1566."—
Wiffen's Introd., &c.
IV.
"Few were the years of the life of Valdés after the conversation of
the 'Alfabeto Christiano,' yet during four, or at the most, five of
them, he presented to Giulia his translation from the Greek of the
Gospel according to Matthew, of the Psalms translated from the
Hebrew, of the Epistle to the Romans, from the Greek, with a
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com