Exploratory Data Analysis with Python Cookbook: Over 50 recipes to analyze, visualize, and extract insights from structured and unstructured data Oluleye download
Exploratory Data Analysis with Python Cookbook: Over 50 recipes to analyze, visualize, and extract insights from structured and unstructured data Oluleye download
https://ebookmass.com/product/statistics-for-biomedical-engineers-and-
scientists-how-to-visualize-and-analyze-data-eckersley/
https://ebookmass.com/product/data-universe-organizational-insights-
with-python-embracing-data-driven-decision-making-van-der-post/
https://ebookmass.com/product/introduction-to-python-for-econometrics-
statistics-and-data-analysis-kevin-sheppard/
https://ebookmass.com/product/python-data-cleaning-cookbook-second-
edition-michael-walker/
Intelligent Data Analysis: From Data Gathering to Data
Comprehension Deepak Gupta
https://ebookmass.com/product/intelligent-data-analysis-from-data-
gathering-to-data-comprehension-deepak-gupta/
https://ebookmass.com/product/exploratory-data-analysis-using-r-1st-
edition-ronald-k-pearson/
https://ebookmass.com/product/data-science-from-scratch-first-
principles-with-python-2nd-edition/
https://ebookmass.com/product/introduction-to-python-for-econometrics-
statistics-and-data-analysis-5th-edition-kevin-sheppard/
Exploratory Data Analysis
with Python Cookbook
Ayodele Oluleye
BIRMINGHAM—MUMBAI
Exploratory Data Analysis with Python Cookbook
Copyright © 2023 Packt Publishing
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 or its dealers and distributors, will be held liable
for any damages caused or alleged to have been 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-80323-110-5
www.packtpub.com
To my wife and daughter, I am deeply grateful for your unwavering support throughout this journey.
Your love and encouragement were pillars of strength that constantly propelled me forward. Your
sacrifices and belief in me have been a constant source of inspiration, and I am truly blessed to have
you both by my side.
To my dad, thank you for instilling in me a solid foundation in technology right from my formative
years. You exposed me to the world of technology in my early teenage years. This has been very
instrumental in shaping my career in tech. To my mum (of blessed memory), thank you for your
unwavering belief in my abilities and constantly nudging me to be my best self.
To PwC Nigeria, Data Scientists Network (DSN) and the Young Data Professionals group (YDP),
thank you for the invaluable role you played in my growth and development in the field of data
science. Your unwavering support, resources, and opportunities have significantly contributed to my
professional growth.
Ayodele Oluleye
Contributors
1
Generating Summary Statistics 1
Technical requirements 1 Identifying the standard deviation of
Analyzing the mean of a dataset 2 a dataset 8
Getting ready 2 Getting ready 9
How to do it… 2 How to do it… 9
How it works... 3 How it works... 9
There’s more... 4 There’s more... 10
2
Preparing Data for EDA 17
Technical requirements 17 Categorizing data 33
Grouping data 18 Getting ready 33
Getting ready 18 How to do it… 33
How to do it… 18 How it works... 35
How it works... 20 There’s more... 35
There’s more... 20 Removing duplicate data 36
See also 20
Getting ready 36
Appending data 20 How to do it… 36
Getting ready 21 How it works... 37
How to do it… 21 There’s more... 38
How it works... 23 Dropping data rows and columns 38
There’s more... 23
Getting ready 38
Concatenating data 24 How to do it… 38
Getting ready 24 How it works... 39
How to do it… 24 There’s more... 40
How it works... 26 Replacing data 40
There’s more... 27
Getting ready 40
See also 27
How to do it… 40
Merging data 27 How it works... 41
Getting ready 28 There’s more... 42
How to do it… 28 See also 42
How it works... 30 Changing a data format 42
There’s more... 30
Getting ready 42
See also 30
How to do it… 42
Sorting data 30 How it works... 44
Getting ready 31 There’s more... 44
How to do it… 31 See also 44
How it works... 32
There’s more... 33
Table of Contents ix
3
Visualizing Data in Python 47
Technical requirements 47 How it works... 60
Preparing for visualization 47 There’s more... 61
See also 61
Getting ready 48
How to do it… 48 Visualizing data in GGPLOT 61
How it works... 49 Getting ready 62
There’s more... 49 How to do it… 62
Visualizing data in Matplotlib 50 How it works... 65
There’s more... 66
Getting ready 50
See also 66
How to do it… 50
How it works... 54 Visualizing data in Bokeh 66
There’s more... 55 Getting ready 66
See also 55 How to do it… 67
Visualizing data in Seaborn 55 How it works... 72
There's more... 73
Getting ready 56
See also 73
How to do it… 56
4
Performing Univariate Analysis in Python 75
Technical requirements 75 How to do it… 80
Performing univariate analysis using How it works... 83
a histogram 76 There’s more... 84
Getting ready 76 Performing univariate analysis using
How to do it… 76 a violin plot 84
How it works... 79 Getting ready 85
Performing univariate analysis using How to do it… 85
a boxplot 79 How it works... 88
Getting ready 80
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
x Table of Contents
5
Performing Bivariate Analysis in Python 99
Technical requirements 100 How to do it… 108
Analyzing two variables using a How it works... 110
scatter plot 100 Analyzing two variables using
Getting ready 101 a bar chart 110
How to do it… 101 Getting ready 111
How it works... 103 How to do it… 111
There’s more... 103 How it works... 113
See also... 104 There is more... 114
Creating a crosstab/two-way table on Generating box plots for two
bivariate data 104 variables114
Getting ready 104 Getting ready 114
How to do it… 104 How to do it… 114
How it works... 105 How it works... 116
Analyzing two variables using a pivot Creating histograms on two variables 116
table106 Getting ready 117
Getting ready 106 How to do it… 117
How to do it… 106 How it works... 119
How it works... 107
There is more... 107 Analyzing two variables using a
correlation analysis 120
Generating pairplots on two variables108 Getting ready 120
Getting ready 108 How to do it… 120
How it works... 122
Table of Contents xi
6
Performing Multivariate Analysis in Python 123
Technical requirements 124 Choosing the number of principal
Implementing Cluster Analysis on components142
multiple variables using Kmeans 124 Getting ready 142
Getting ready 124 How to do it… 142
How to do it… 125 How it works... 145
How it works... 127 Analyzing principal components 146
There is more... 128
Getting ready 146
See also... 128
How to do it… 146
Choosing the optimal number of How it works... 149
clusters in Kmeans 129 There’s more... 150
Getting ready 129 See also... 150
How to do it… 129 Implementing factor analysis on
How it works... 132 multiple variables 150
There is more... 133
Getting ready 150
See also... 133
How to do it… 151
Profiling Kmeans clusters 133 How it works... 154
Getting ready 134 There is more... 154
How to do it… 134 Determining the number of factors 154
How it works... 137
Getting ready 155
There’s more... 138
How to do it… 155
Implementing principal component How it works... 158
analysis on multiple variables 138 Analyzing the factors 159
Getting ready 139
Getting ready 159
How to do it… 139
How to do it… 159
How it works... 141
How it works... 165
There is more... 142
See also... 142
7
Analyzing Time Series Data in Python 167
Technical requirements 168 Using line and boxplots to visualize
time series data 169
xii Table of Contents
8
Analysing Text Data in Python 211
Technical requirements 212 Analyzing part of speech 224
Preparing text data 212 Getting ready 225
Getting ready 213 How to do it… 225
How to do it… 214 How it works... 229
How it works... 217 Performing stemming and
There’s more… 218 lemmatization230
See also… 218
Getting ready 230
Dealing with stop words 218 How to do it… 231
Getting ready 219 How it works... 237
How to do it… 219 Analyzing ngrams 237
How it works... 224
Getting ready 238
There’s more… 224
How to do it… 238
Table of Contents xiii
9
Dealing with Outliers and Missing Values 269
Technical requirements 270 Flooring and capping outliers 290
Identifying outliers 270 Getting ready 290
Getting ready 271 How to do it… 290
How to do it… 271 How it works... 293
How it works... 273 Removing outliers 294
Spotting univariate outliers 274 Getting ready 294
Getting ready 274 How to do it… 294
How to do it… 274 How it works... 296
How it works... 277 Replacing outliers 297
Finding bivariate outliers 278 Getting ready 297
Getting ready 278 How to do it… 297
How to do it… 279 How it works... 300
How it works... 281 Identifying missing values 301
Identifying multivariate outliers 282 Getting ready 302
Getting ready 282 How to do it… 302
How to do it… 282 How it works... 305
How it works... 288
See also 289
xiv Table of Contents
10
Performing Automated Exploratory Data Analysis in Python 315
Technical requirements 316 Getting ready 331
Doing Automated EDA using pandas How to do it… 331
profiling316 How it works... 335
Getting ready 317 See also 336
How to do it… 318 Performing Automated EDA using
How it works... 324 Sweetviz336
See also… 324 Getting ready 336
Performing Automated EDA using How to do it… 336
dtale325 How it works... 339
Getting ready 325 See also 340
How to do it… 325 Implementing Automated EDA
How it works... 330 using custom functions 340
See also 330 Getting ready 340
Doing Automated EDA using How to do it… 340
AutoViz330 How it works... 347
There’s more… 348
Index349
SciPy to compute measures (like the mean, median, mode, standard deviation, percentiles, and other
critical summary statistics). By the end of the chapter, you will have gained the required knowledge
for generating summary statistics in Python. You will also have gained the foundational knowledge
required for understanding some of the more complex EDA techniques covered in other chapters.
Chapter 2, Preparing Data for EDA, focuses on the critical steps required to prepare data for analysis.
Real-world data rarely come in a ready-made format, hence the reason for this very crucial step in EDA.
Through practical examples, you will learn aggregation techniques such as grouping, concatenating,
appending, and merging. You will also learn data-cleaning techniques, such as handling missing
values, changing data formats, removing records, and replacing records. Lastly, you will learn how to
transform data by sorting and categorizing it.
By the end of this chapter, you will have mastered the techniques in Python required for preparing
data for EDA.
Chapter 3, Visualizing Data in Python, covers data visualization tools critical for uncovering hidden
trends and patterns in data. It focuses on popular visualization libraries in Python, such as Matplotlib,
Seaborn, GGPLOT and Bokeh, which are used to create compelling representations of data. It also
provides the required foundation for subsequent chapters in which some of the libraries will be used.
With practical examples and a step-by-step guide, you will learn how to plot charts and customize
them to present data effectively. By the end of this chapter, you will be equipped with the knowledge
and hands-on experience of Python’s visualization capabilities to uncover valuable insights.
Chapter 4, Performing Univariate Analysis in Python, focuses on essential techniques for analyzing
and visualizing a single variable of interest to gain insights into its distribution and characteristics.
Through practical examples, it delves into a wide range of visualizations such as histograms, boxplots,
bar plots, summary tables, and pie charts required to understand the underlying distribution of a
single variable and uncover hidden patterns in the variable. It also covers univariate analysis for both
categorical and numerical variables.
By the end of this chapter, you will be equipped with the knowledge and skills required to perform
comprehensive univariate analysis in Python to uncover insights.
Chapter 5, Performing Bivariate Analysis in Python, explores techniques for analyzing the relationships
between two variables of interest and uncovering meaningful insights embedded in them. It delves
into various techniques, such as correlation analysis, scatter plots, and box plots required to effectively
understand relationships, trends, and patterns that exist between two variables. It also explores the
various bivariate analysis options for different variable combinations, such as numerical-numerical,
numerical-categorical, and categorical-categorical. By the end of this chapter, you will have gained
the knowledge and hands-on experience required to perform in-depth bivariate analysis in Python
to uncover meaningful insights.
Chapter 6, Performing Multivariate Analysis in Python, builds on previous chapters and delves into some
more advanced techniques required to gain insights and identify complex patterns within multiple
variables of interest. Through practical examples, it delves into concepts, such as clustering analysis,
Preface xvii
principal component analysis and factor analysis, which enable the understanding of interactions
among multiple variables of interest. By the end of this chapter, you will have the skills required to
apply advanced analysis techniques to uncover hidden patterns in multiple variables.
Chapter 7, Analyzing Time Series Data, offers a practical guide to analyze and visualize time series
data. It introduces time series terminologies and techniques (such as trend analysis, decomposition,
seasonality detection, differencing, and smoothing) and provides practical examples and code on
how to implement them using various libraries in Python. It also covers how to spot patterns within
time series data to uncover valuable insights. By the end of the chapter, you will be equipped with the
relevant skills required to explore, analyze, and derive insights from time series data.
Chapter 8, Analyzing Text Data, covers techniques for analyzing text data, a form of unstructured
data. It provides a comprehensive guide on how to effectively analyze and extract insights from text
data. Through practical steps, it covers key concepts and techniques for data preprocessing such as
stop-word removal, tokenization, stemming, and lemmatization. It also covers essential techniques
for text analysis such as sentiment analysis, n-gram analysis, topic modelling, and part-of-speech
tagging. At the end of this chapter, you will have the necessary skills required to process and analyze
various forms of text data to unpack valuable insights.
Chapter 9, Dealing with Outliers and Missing Values, explores the process of effectively handling outliers
and missing values within data. It highlights the importance of dealing with missing values and outliers
and provides step-by-step instructions on how to handle them using visualization techniques and
statistical methods in Python. It also delves into various strategies for handling missing values and
outliers within different scenarios. At the end of the chapter, you will have the essential knowledge of
the tools and techniques required to handle missing values and outliers in various scenarios.
Chapter 10, Performing Automated EDA, focuses on speeding up the EDA process through automation.
It explores the popular automated EDA libraries in Python, such as Pandas Profiling, Dtale, SweetViz,
and AutoViz. It also provides hands-on guidance on how to build custom functions to automate the
EDA process yourself. With step-by-step instructions and practical examples, it will empower you to
gain deep insights quickly from data and save time during the EDA process.
If you are using the digital version of this book, we advise you to type the code yourself or access
the code from the book’s GitHub repository (a link is available in the next section). Doing so will
help you avoid any potential errors related to the copying and pasting of code.
Conventions used
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file
extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “Create a
histogram using the histplot method in seaborn and specify the data using the data parameter
of the method.”
A block of code is set as follows:
import numpy as np
import pandas as pd
import seaborn as sns
When we wish to draw your attention to a particular part of a code block, the relevant lines or items
are set in bold:
data.shape
(30,2)
Bold: Indicates a new term, an important word, or words that you see onscreen. For instance,
words in menus or dialog boxes appear in bold. Here is an example: “Select System info from the
Administration panel.”
Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, email us at customercare@
packtpub.com and mention the book title in the subject of your message.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen.
If you have found a mistake in this book, we would be grateful if you would report this to us. Please
visit www.packtpub.com/support/errata and fill in the form.
Piracy: If you come across any illegal copies of our works in any form on the internet, we would
be grateful if you would provide us with the location address or website name. Please contact us at
[email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you
are interested in either writing or contributing to a book, please visit authors.packtpub.com.
In eben dieser Zeit schrieb Paulus auch auf Bitten des Bischofs
Angilram von Metz die Geschichte von dessen Vorfahren auf dem
Stuhl des heiligen Clemens[15]. „Mit besonderer Ausführlichkeit
behandelte er darin die Familie und die Ahnen Karls des Großen,
vielleicht,“ wie Bethmann sagt, „auf dessen eigenen Wunsch oder
wenigstens ihm zu Gefallen, und nicht undeutlich blickt die Absicht
durch, die Thronbesteigung der Karolinger zu rechtfertigen und sie
als ein durch Heilige gleichsam legitimes Herrscherhaus
darzustellen.“ Doch hat gegen diese Auffassung Bonnell[16] nicht
unerhebliche Gründe geltend gemacht, und nur die Verherrlichung
des Ahnherrn Arnulf im Anschluß an dessen ältere
Lebensbeschreibung bestehen lassen.
Paulus gab in diesem Werke das erste Beispiel und Vorbild der
Bisthumsgeschichten. Auch eine Biographie Gregors des Großen hat
Paulus nach seiner eigenen Angabe geschrieben[17]; daß er aber
auch derjenige Paulus gewesen wäre, welcher eine kritisch
verbesserte Auswahl aus Gregors Briefen an Adalhard schickte, ist
mindestens sehr unsicher[18]. Dagegen bemerkt Dümmler, daß er
wohl der in einem Schreiben Hadrians I (Bibl. IV, 274) erwähnte
Paulus grammaticus sein könne, welcher Gregors I Sacramentar für
Karl von ihm erbeten hatte.
Angilberti Carmina ed. Dümmler, Poet. Lat. I, 355-381; vgl. NA. IV, 140-142. Die
älteren Drucke, gesammelt bei Migne XCIX, 849-854, dadurch veraltet. Herm.
Althof: Angilberts Leben und Dichtungen (übersetzt). Wiss. Beilage z. Progr.
des Realprogymn. u. Progymn. zu Münden. Bes. Abdr. Hann. Münden 1888.
Traube, O Roma nobilis (Abh. d. Münch. Akad. I. CI. XIX, 2) S. 326-331. Verz.
seiner Gedichte. Ein Abt Angilbert von Corbie zugeschriebenes Gedicht ihm
zugesprochen. Ders., Karol. Dicht. I, 51-60 gewinnt Gedichte Angilberts aus
denen des Bernowin (Poet. Lat. I, 413-425), der sich als Plagiator A.'s
Gedichte angeeignet hat.
Noch hatte sich am fränkischen Hofe aus Karl Martels Zeit die
Sitte erhalten, daß die Einkünfte reicher Abteien zum Unterhalt der
Hofleute verwandt wurden, und auch Angilbert war 790 Abt von
Centula oder Saint-Riquier in der Picardie geworden[6]. Er
betrachtete aber diese Würde nicht als eine bloße Pfründe, sondern
stellte es sich vielmehr zur Aufgabe, dieses Kloster so herrlich wie
möglich auszustatten. Unterstützt durch Karls fürstliche
Freigiebigkeit, mit Hülfe königlicher Baumeister und Künstler, baute
er es von Grund aus neu, und auch hierher kamen antike Säulen und
Marmorstücke aus Italien. Angilbert selbst hat darüber einen Bericht
geschrieben, der fast vollständig in Hariulfs Chronik aufgenommen
ist[7]. Die vollendete Kirche schmückte er in glänzendster Weise mit
jedem Zubehör des prachtvollen Kirchendienstes; namentlich ließ er
sich, wie Arn, die Pflege der Bibliothek angelegen sein und
bereicherte diese mit 200 Büchern. Vielleicht das köstlichste unter
diesen für die Mönche von Centula war das Leben ihres Stifters, des
h. Rich a r ius, welches auf Angilberts Bitten sein Freund Alcuin nach
den gesteigerten Anforderungen der Zeit neu bearbeitete[8]. Im
Jahre 800 hatte Angilbert die Freude, seinen königlichen Freund in
den Mauern seines Klosters als Gast zu empfangen, der bei ihm am
19. April das Osterfest feierte, und wie er diesem Zeit seines Lebens
in treuester Freundschaft zugethan war, so folgte er ihm auch am
18. Februar 814 im Tode nach.
Geglaubt hat man, daß uns auch noch aus einem größeren
Werke Angilberts ein Bruchstück erhalten sei. Sein Dichtername
Homer, den ihm Karl selbst 796 beilegt, in dem Briefe, welcher die
wichtigsten Aufträge für seine römische Gesandtschaft enthält[18],
deutet auf große Erwartungen, die sich an ihn knüpften, die
Erwartung, daß er Karls Thaten in einem Epos feiern werde. Wenn
wir daher einem solchen Epos wirklich begegnen, so ist wohl die
Vermuthung gerechtfertigt, daß kein anderer als Angilbert der
Verfasser sein könne. Hegewisch hat deshalb bereits diese
Vermuthung ausgesprochen, und Pertz das Gedicht unter Angilberts
Namen herausgegeben[19]. Allein der Abstand von Angilberts
Werken in der Beherrschung der Sprache und der Behandlung des
Verses zu Gunsten dieser Dichtung ist doch zu groß, um beide
demselben Verfasser zuschreiben zu können. Auffallend ist es, da wir
doch im Ganzen über diese Zeit so genau unterrichtet sind, von
einem so bedeutenden Werke gar keine Erwähnung zu finden.
Vermuthlich ist es unvollendet geblieben, und deshalb weder
vollständig erhalten, noch hinlänglich beachtet, um von anderen
genannt zu werden. Doch würde Angilberts Dichtername Homer
wenigstens eine Hindeutung enthalten, die für andere, wie Theodulf,
den Dümmler vermuthungsweise genannt hat, gänzlich fehlt. Ein
Citat freilich ist uns jetzt bekannt geworden: in der oben S. 156
angeführten Ecloge des Naso wird ein Dichtergreis eingeführt, den
er Mico n nennt, und dieser verwendet einen Vers aus jenem Epos
zum Preise des Kaisers (p. 389, v. 74). Doch kann er ihn sich ebenso
wie so manchen Vergilvers angeeignet haben. Vorher spricht Naso
von dem Dichterruhm des Alcuin, Theodulf, Einhard, und setzt hinzu:
"Nam meus ecce solet magno facundus Homerus Carminibus Carolo
studiosis saepe placere." Daß aber nun dieser Homer eben der Micon
sei, darauf deutet nichts, und wir dürfen es kaum annehmen. Wir
ersehen hieraus nur, daß schon wenige Jahre nach der
Kaiserkrönung das Gedicht vorhanden war. Sicher war der Verfasser
ein Mann von ungewöhnlichem Geiste und großer dichterischer
Begabung, der sich den Unterricht der Hofschule mit bestem Erfolge
zu Nutze gemacht hat. Dafür zeugt die fleißige, man muß wohl
sagen übermäßige, Benutzung des Vergil, Ovid, Lucan, und wie B.
Simson nachgewiesen hat[20], Venantius Fortunatus, zu denen
Manitius noch mehrere hinzugefügt hat, welche ihm an sich so wenig
zum Vorwurf gemacht werden kann, wie Einhard die Nachahmung
des Sueton, und bei seinen Zeitgenossen gewiß eher Bewunderung
als Tadel erregte, wenn er auch in übergroßem Eifer nach dem
Vorbild von Karthago sogar von Hafenbauten bei Aachen dichtete.
Auch zu Karls Akademie muß der Dichter gehört haben, da er ihn
immer David nennt, was ein anderer sich gewiß nicht hätte erlauben
dürfen, und die lebendige Schilderung verräth sowohl den
Augenzeugen als auch einen Mann, der Karls Hofe nicht fern stand,
was freilich bei einem so ausgezeichneten Dichter ohnehin mit voller
Sicherheit anzunehmen ist.
Erhalten ist uns der Anfang des dritten Buches oder vielleicht
das ganze, 536 Verse, vermuthlich ein Stück, welches seiner
besonderen Schönheit wegen einzeln in eine Blumenlese
aufgenommen war, denn es steht mitten zwischen anderen
Bruchstücken. Die Geschichte der Gegenwart episch zu behandeln,
ist stets ein Mißgriff, und immer werden es die einzelnen
Schilderungen sein, welche einem solchen Werke seinen Reiz
verleihen. Aber auch die Anlage ist hier doch sehr geschickt
entworfen. In voller Pracht wird Karls Hofhaltung uns vor Augen
geführt; eine Lobrede auf den großen König eröffnet das Buch, dann
werden die Bauten zu Aachen und eine große Jagd mit reichen
Farben und lebendiger Anschaulichkeit geschildert: mit besonderer
Vorliebe verweilt der Dichter bei den Töchtern Karls, zu denen wohl
kein anderer Dichter der Zeit in so nahem Verhältniß stand wie
Angilbert. In der Nacht läßt dann der Dichter den König im Traume
die Mißhandlung erblicken, welche der Pabst Leo 799 in Rom erfuhr;
er weicht darin von der Wirklichkeit ab, aber wenn man einmal die
Geschichte episch behandeln will, so ist eine solche Wendung
geschickt genug, um ohne lange Vorbereitungen die Hauptereignisse
einander nahe zu rücken[21]. Ohne von den umständlichen
Gesandtschaften, welche in der Wirklichkeit dazwischen lagen,
berichten zu müssen, gelangt so der Dichter sogleich zu der
Zusammenkunft Karls mit dem Pabste im Lager bei Paderborn,
welche den eigentlichen Gegenstand seiner Darstellung bildet.
Pertz, MG. SS. II, 426-430. Baehr S. 200-216. O. Abel, Kaiser Karls Leben von
Einhard, S. 1-18. Eug. Bacha bei Kurth: Dissertations acad. Liège 1888. Opera
ed. Teulet, Par. 1840, 1843, 8. 2 Bände. Jaffé, Bibl. IV, 487-506; vgl. die
zweite Ausgabe der Vita Caroli M. cur. W. Wattenbach, 1876. Vita Caroli ed.
Waitz, 1880. Ebert II, 92-104. Bursian, Gesch. d. Philol. S. 21. M. Manitius,
Einharts Werke und ihr Stil, NA. VII, 517-568. Nachtrag VIII, 193. XI, 64-73.
Und doch zeigt sich auch gerade darin wieder eine Gefahr der
damaligen Richtung; so viel anziehendes Einhard auch hat, es fehlt
ihm die frische Natürlichkeit anderer, er schreibt fast wie Sueton,
aber es war nicht das richtige Ziel des Mittelalters, zu schreiben wie
Sueton, so wenig wie am Beginn der neueren Zeit diejenigen das
Höchste erreicht haben, welche fast wie Cicero schrieben.
Man hätte in die Gefahr kommen können, nichts als ein mattes
Abbild der römischen Kaiserzeit darzustellen, wenn nicht doch
dagegen das widerstrebende Element der Kirche immer geschützt
hätte, welches sich in dieser Form nicht fesseln lassen konnte, und
das unvertilgbare frische Leben der Völker, welches nicht ruhte, bis
es sich seine eigenen neuen Formen geschaffen hatte.
Einhard — denn so, nicht Eginhard, wird der Name von seinen
Zeitgenossen urkundlich geschrieben[3] — ist um das Jahr 770 in
Ostfranken im Maingau von edlen Eltern[4] geboren, und erhielt
seine früheste Erziehung im Kloster Fulda[5], zu dem er auch immer
in freundschaftlicher Beziehung blieb: noch bewahren sechs von ihm
unter Abt Baugulf (779-802) geschriebene Urkunden, wenn gleich
nicht im Original erhalten, das Andenken an jene Zeit. Darunter ist
eine Schenkung der Ehegatten Einhart und Engilfrit, höchst
wahrscheinlich seiner Eltern; zwei vom 19. April 788 und vom 12.
September 791 dienen zur Zeitbestimmung[6]. So sehr zeichnete er
sich durch seine Fähigkeiten und Fortschritte aus, dass Abt Baugulf
ihn an den Hof des Königs schickte, denn dieser, das wußte Baugulf,
trachtete eifrigst danach, die fähigsten und gelehrtesten Männer aus
dem ganzen Reiche um sich zu versammeln. In der Hofschule also
vollendete er seine Ausbildung, und erwarb sich bald die
Anerkennung, welcher beim ersten Anblick seine kleine Gestalt
hinderlich war. Homuncio nennt ihn deshalb Walahfrid, nam statura
despicabilis videbatur. Und Theodulf sagt 796 in dem oben
erwähnten Gedicht an Karl v. 155 ff. von ihm:
Nardulus huc illuc discurrat perpete gressu:
Ut formica tuus pes redit itque frequens,
Ipse legens infirma deus, sic fortia temnit. (I. Cor. 1, 27.)
Eine reiche Quelle für die Geschichte des letzten Jahrzehnts von
Ludwigs des Frommen Regierung, leider nicht für die frühere Zeit,
bieten uns die B r ie fe Einhards und anderer an ihn, oder die auf
irgend eine Weise in seinen Besitz gekommen waren[19], welche in
seinem Genter Kloster als Muster gesammelt wurden; die
Eigennamen wurden als überflüssig meistens beseitigt. Die
Handschrift kam mit den vor den Normannen flüchtenden Mönchen
nach Laon, wo sie in stark beschädigtem Zustande geblieben ist, bis
Pertz sie 1827 dort entdeckte, worauf sie wenig später nach Paris
gebracht wurde. Nachdem zuerst Teulet die Handschrift wieder
benutzt hatte, liegt nun von Jaffé eine zu bequemem Gebrauche
kritisch bearbeitete Ausgabe vor[20].
Da s Lebe n K a r l s.
Ausgabe von Pertz MG. SS. II, 426-463. Besonderer Abdruck, 3. Ausgabe 1863,
mit einem Anhang von Gedichten. Ueber später gefundene Handschriften NA.
VI, 195. Cod. Monac. 17134 aus Scheftlarn mit Interpolationen aus den
Annalen über Tassilo, s. Graf Hundt in d. S. 154 angef. Abh. S. 191. Cod. Paris
4937 ist mit dem Fonds Barrois wieder erworben. Eine Hds. im Catalog von
1412 des Kl. Amelungsborn, Dürre im Progr. d. Gymn. zu Holzminden 1876 S.
22. Ideler: Leben und Wandel Karls des Großen von Einhard (Text mit
Commentar und Beilagen), 2 Bde. 1839. Ausg. von Jaffé, Bibl. IV, 487-581,
und bes. Abdruck, 1867; 1876 cur. W. Wattenbach. Ed. Waitz. 1880; A. Holder
1881. Uebers. v. O. Abel, Geschichtschr. 16 (IX, 1) 1850, 1880.
Verbesserungen von Fröhner, Krit. Analecten, Philologus, Suppl. Bd. V, S. 93.
Fr. Schmidt De Einhardo Suet. imitatore, Progr. 1880. Manitius, Anklänge an
Vergil, NA. IX, 617, an Sulpicius Severus, Vellejus u. Curtius ib. XII, 205. 206;
an Justin XIII, 213. E. Bernheim, Waitz-Aufsätze S. 73-96, über das Verhältniß
zu Sueton und zu den Ann. Einhardi, die er benutzt habe, vgl. NA. XII, 427.
Nachdem die Vita Caroli schon 1521 (oben S. 5) und dann sehr
häufig gedruckt war, hat Pertz 1829 mit übergroßer Fülle von
Varianten eine Ausgabe gegeben, deren Text nicht überall den
Vorzug vor den älteren Ausgaben verdient[24]. Jaffé hat in seiner
neuen Ausgabe 1867 eine früher übersehene Pariser Handschrift zu
Grunde gelegt, und endlich Walahfrids Prolog damit verbunden,
welchen Pertz mit der ihm eigenen Starrheit auch noch in der
neuesten Ausgabe unberücksichtigt gelassen hatte[25]. Doch hat
auch diese Grundlage sich nicht zu bewähren vermocht. Waitz hat
die Ueberschätzung der nicht mustergültigen Pariser Hs.
nachgewiesen, und endlich mit Benutzung neuer Hülfsmittel, und
Unterscheidung verschiedener Recensionen, die vielleicht an Einhard
selbst hinanreichen, einen neuen besser gesicherten Text hergestellt.
Mit den Kreuzzügen artete die Karlssage aus und verlor allen
geschichtlichen Inhalt; besonders die Aachener Reliquien brachten
die Erzählung von Karls Kreuzfahrt zu allgemeiner Geltung, und
fortan treten die Lügen des falschen Turpin an die Stelle von
Einhards treuer Schilderung. Wie daneben im Munde der fahrenden
Sänger das Andenken Karls sich erhielt und umwandelte, darüber
genügt es, auf das schöne Werk von Gaston Paris Histoire poétique
de Charlemagne (Paris 1865) zu verweisen.
ebookmasss.com