100% found this document useful (2 votes)
18 views55 pages

A Python Data Analyst’s Toolkit: Learn Python and Python-based Libraries with Applications in Data Analysis and Statistics Gayathri Rajagopalan instant download

The document provides an overview of a book titled 'A Python Data Analyst’s Toolkit' by Gayathri Rajagopalan, which focuses on learning Python and its libraries for data analysis and statistics. It includes various chapters covering topics such as Python basics, data structures, data analysis techniques, and practical applications with libraries like NumPy and Pandas. Additionally, it offers links to other related resources and books for further learning in data analysis with Python.

Uploaded by

dhpocslap6702
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
18 views55 pages

A Python Data Analyst’s Toolkit: Learn Python and Python-based Libraries with Applications in Data Analysis and Statistics Gayathri Rajagopalan instant download

The document provides an overview of a book titled 'A Python Data Analyst’s Toolkit' by Gayathri Rajagopalan, which focuses on learning Python and its libraries for data analysis and statistics. It includes various chapters covering topics such as Python basics, data structures, data analysis techniques, and practical applications with libraries like NumPy and Pandas. Additionally, it offers links to other related resources and books for further learning in data analysis with Python.

Uploaded by

dhpocslap6702
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

A Python Data Analyst’s Toolkit: Learn Python

and Python-based Libraries with Applications in


Data Analysis and Statistics Gayathri
Rajagopalan download
https://textbookfull.com/product/a-python-data-analysts-toolkit-
learn-python-and-python-based-libraries-with-applications-in-
data-analysis-and-statistics-gayathri-rajagopalan/

Download full version ebook from https://textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

Data Analysis from Scratch with Python Peters Morgan

https://textbookfull.com/product/data-analysis-from-scratch-with-
python-peters-morgan/

Data Analysis with Python and PySpark (MEAP V07)


Jonathan Rioux

https://textbookfull.com/product/data-analysis-with-python-and-
pyspark-meap-v07-jonathan-rioux/

Python for Data Analysis Data Wrangling with Pandas


NumPy and IPython Wes Mckinney

https://textbookfull.com/product/python-for-data-analysis-data-
wrangling-with-pandas-numpy-and-ipython-wes-mckinney/

Python Data Analysis: Perform data collection, data


processing, wrangling, visualization, and model
building using Python 3rd Edition Avinash Navlani

https://textbookfull.com/product/python-data-analysis-perform-
data-collection-data-processing-wrangling-visualization-and-
model-building-using-python-3rd-edition-avinash-navlani/
Practical Python Data Visualization: A Fast Track
Approach To Learning Data Visualization With Python
Ashwin Pajankar

https://textbookfull.com/product/practical-python-data-
visualization-a-fast-track-approach-to-learning-data-
visualization-with-python-ashwin-pajankar/

Python 2 and 3 Compatibility: With Six and Python-


Future Libraries Nanjekye

https://textbookfull.com/product/python-2-and-3-compatibility-
with-six-and-python-future-libraries-nanjekye/

Learning Data Mining with Python Layton

https://textbookfull.com/product/learning-data-mining-with-
python-layton/

A Tour Of Data Science: Learn R And Python In Parallel


Nailong Zhang

https://textbookfull.com/product/a-tour-of-data-science-learn-r-
and-python-in-parallel-nailong-zhang/

Hands-on Scikit-Learn for machine learning


applications: data science fundamentals with Python
David Paper

https://textbookfull.com/product/hands-on-scikit-learn-for-
machine-learning-applications-data-science-fundamentals-with-
python-david-paper/
A Python Data
Analyst’s Toolkit
Learn Python and Python-based
Libraries with Applications in Data
Analysis and Statistics

Gayathri Rajagopalan
A Python Data
Analyst’s Toolkit
Learn Python and Python-based
Libraries with Applications in Data
Analysis and Statistics

Gayathri Rajagopalan
A Python Data Analyst’s Toolkit: Learn Python and Python-based Libraries with
Applications in Data Analysis and Statistics
Gayathri Rajagopalan

ISBN-13 (pbk): 978-1-4842-6398-3 ISBN-13 (electronic): 978-1-4842-6399-0


https://doi.org/10.1007/978-1-4842-6399-0

Copyright © 2021 by Gayathri Rajagopalan


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Celestin Suresh John
Development Editor: James Markham
Coordinating Editor: Aditee Mirashi
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza,
Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail
[email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC
and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM
Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for reprint,
paperback, or audio rights, please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book’s product page, located at www.apress.com/978-1-4842-6398-3. For more
detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
This book is dedicated to my daughter.
Table of Contents
About the Author��������������������������������������������������������������������������������������������������� xiii

About the Technical Reviewer���������������������������������������������������������������������������������xv


Acknowledgments�������������������������������������������������������������������������������������������������xvii

Introduction������������������������������������������������������������������������������������������������������������xix

Chapter 1: Getting Familiar with Python������������������������������������������������������������������ 1


Technical requirements����������������������������������������������������������������������������������������������������������������� 1
Getting started with Jupyter notebooks���������������������������������������������������������������������������������������� 2
Shortcuts and other features in Jupyter���������������������������������������������������������������������������������� 5
Tab Completion������������������������������������������������������������������������������������������������������������������������ 7
Magic commands used in Jupyter������������������������������������������������������������������������������������������ 7
Python Basics������������������������������������������������������������������������������������������������������������������������������� 8
Comments, print, and input����������������������������������������������������������������������������������������������������� 8
Variables and Constants�������������������������������������������������������������������������������������������������������� 11
Operators������������������������������������������������������������������������������������������������������������������������������� 12
Data types����������������������������������������������������������������������������������������������������������������������������� 15
Working with Strings������������������������������������������������������������������������������������������������������������� 20
Conditional statements���������������������������������������������������������������������������������������������������������� 25
Loops������������������������������������������������������������������������������������������������������������������������������������� 26
Functions������������������������������������������������������������������������������������������������������������������������������� 29
Syntax errors and exceptions����������������������������������������������������������������������������������������������������� 31
Working with files����������������������������������������������������������������������������������������������������������������������� 32
Reading from a file���������������������������������������������������������������������������������������������������������������� 33
Writing to a file���������������������������������������������������������������������������������������������������������������������� 34
Modules in Python���������������������������������������������������������������������������������������������������������������������� 35

v
Table of Contents

Python Enhancement Proposal (PEP) 8 – standards for writing code����������������������������������������� 36


Summary������������������������������������������������������������������������������������������������������������������������������������ 38
Review Exercises������������������������������������������������������������������������������������������������������������������������ 39

Chapter 2: Exploring Containers, Classes, and Objects������������������������������������������ 45


Containers����������������������������������������������������������������������������������������������������������������������������������� 45
Lists��������������������������������������������������������������������������������������������������������������������������������������� 45
Tuples������������������������������������������������������������������������������������������������������������������������������������ 56
Dictionaries��������������������������������������������������������������������������������������������������������������������������� 59
Sets��������������������������������������������������������������������������������������������������������������������������������������� 63
Object-oriented programming���������������������������������������������������������������������������������������������������� 65
Object-oriented programming principles������������������������������������������������������������������������������ 67
Summary������������������������������������������������������������������������������������������������������������������������������������ 70
Review Exercises������������������������������������������������������������������������������������������������������������������������ 71

Chapter 3: Regular Expressions and Math with Python����������������������������������������� 77


Regular expressions������������������������������������������������������������������������������������������������������������������� 77
Steps for solving problems with regular expressions����������������������������������������������������������� 77
Python functions for regular expressions������������������������������������������������������������������������������ 79
Using Sympy for math problems������������������������������������������������������������������������������������������������� 86
Factorization of an algebraic expression������������������������������������������������������������������������������� 86
Solving algebraic equations (for one variable)���������������������������������������������������������������������� 87
Solving simultaneous equations (for two variables)�������������������������������������������������������������� 87
Solving expressions entered by the user������������������������������������������������������������������������������� 88
Solving simultaneous equations graphically������������������������������������������������������������������������� 89
Creating and manipulating sets��������������������������������������������������������������������������������������������� 90
Union and intersection of sets����������������������������������������������������������������������������������������������� 90
Finding the probability of an event���������������������������������������������������������������������������������������� 91
Solving questions in calculus������������������������������������������������������������������������������������������������ 92
Summary������������������������������������������������������������������������������������������������������������������������������������ 94
Review Exercises������������������������������������������������������������������������������������������������������������������������ 95

vi
Table of Contents

Chapter 4: Descriptive Data Analysis Basics�������������������������������������������������������� 101


Descriptive data analysis - Steps��������������������������������������������������������������������������������������������� 101
Structure of data����������������������������������������������������������������������������������������������������������������������� 104
Classifying data into different levels����������������������������������������������������������������������������������������� 104
Visualizing various levels of data���������������������������������������������������������������������������������������������� 106
Plotting mixed data������������������������������������������������������������������������������������������������������������� 110
Summary���������������������������������������������������������������������������������������������������������������������������������� 113
Review Exercises���������������������������������������������������������������������������������������������������������������������� 113

Chapter 5: Working with NumPy Arrays��������������������������������������������������������������� 117


Getting familiar with arrays and NumPy functions������������������������������������������������������������������� 117
Creating an array���������������������������������������������������������������������������������������������������������������������� 118
Reshaping an array������������������������������������������������������������������������������������������������������������� 121
Combining arrays���������������������������������������������������������������������������������������������������������������� 125
Testing for conditions���������������������������������������������������������������������������������������������������������� 127
Broadcasting, vectorization, and arithmetic operations������������������������������������������������������������ 130
Obtaining the properties of an array����������������������������������������������������������������������������������������� 133
Slicing or selecting a subset of data����������������������������������������������������������������������������������������� 136
Obtaining descriptive statistics/aggregate measures�������������������������������������������������������������� 138
Matrices������������������������������������������������������������������������������������������������������������������������������������ 140
Summary���������������������������������������������������������������������������������������������������������������������������������� 140
Review Exercises���������������������������������������������������������������������������������������������������������������������� 141

Chapter 6: Prepping Your Data with Pandas��������������������������������������������������������� 147


Pandas at a glance�������������������������������������������������������������������������������������������������������������������� 147
Technical requirements������������������������������������������������������������������������������������������������������������� 149
Building blocks of Pandas��������������������������������������������������������������������������������������������������������� 149
Examining the properties of a Series���������������������������������������������������������������������������������������� 152
DataFrames������������������������������������������������������������������������������������������������������������������������������� 156
Creating DataFrames by importing data from other formats���������������������������������������������� 158
Accessing attributes in a DataFrame���������������������������������������������������������������������������������� 160
Modifying DataFrame objects���������������������������������������������������������������������������������������������� 161
vii
Table of Contents

Indexing������������������������������������������������������������������������������������������������������������������������������������ 169
Type of an index object�������������������������������������������������������������������������������������������������������� 170
Creating a custom index and using columns as indexes���������������������������������������������������� 171
Indexes and speed of data retrieval������������������������������������������������������������������������������������ 173
Immutability of an index������������������������������������������������������������������������������������������������������ 174
Alignment of indexes����������������������������������������������������������������������������������������������������������� 176
Set operations on indexes��������������������������������������������������������������������������������������������������� 177
Data types in Pandas���������������������������������������������������������������������������������������������������������������� 178
Obtaining information about data types������������������������������������������������������������������������������ 179
Indexers and selection of subsets of data�������������������������������������������������������������������������������� 182
Understanding loc and iloc indexers����������������������������������������������������������������������������������� 183
Other (less commonly used) indexers for data access�������������������������������������������������������� 188
Boolean indexing for selecting subsets of data������������������������������������������������������������������� 192
Using the query method to retrieve data����������������������������������������������������������������������������� 192
Operators in Pandas������������������������������������������������������������������������������������������������������������������ 193
Representing dates and times in Pandas��������������������������������������������������������������������������������� 194
Converting strings into Pandas Timestamp objects������������������������������������������������������������ 195
Extracting the components of a Timestamp object������������������������������������������������������������� 196
Grouping and aggregation�������������������������������������������������������������������������������������������������������� 197
Examining the properties of the groupby object����������������������������������������������������������������� 199
Filtering groups������������������������������������������������������������������������������������������������������������������� 201
Transform method and groupby������������������������������������������������������������������������������������������ 202
Apply method and groupby������������������������������������������������������������������������������������������������� 204
How to combine objects in Pandas������������������������������������������������������������������������������������������� 204
Append method for adding rows����������������������������������������������������������������������������������������� 205
Concat function (adding rows or columns from other objects)������������������������������������������� 207
Join method – index to index���������������������������������������������������������������������������������������������� 210
Merge method – SQL type join based on common columns����������������������������������������������� 211

viii
Table of Contents

Restructuring data and dealing with anomalies����������������������������������������������������������������������� 213


Dealing with missing data��������������������������������������������������������������������������������������������������� 214
Data duplication������������������������������������������������������������������������������������������������������������������ 218
Tidy data and techniques for restructuring data����������������������������������������������������������������������� 220
Conversion from wide to long format (tidy data)����������������������������������������������������������������� 221
Stack method (wide-to-long format conversion)���������������������������������������������������������������� 223
Melt method (wide-to-long format conversion)������������������������������������������������������������������ 226
Pivot method (long-to-wide conversion)����������������������������������������������������������������������������� 228
Summary���������������������������������������������������������������������������������������������������������������������������������� 229
Review Exercises���������������������������������������������������������������������������������������������������������������������� 230

Chapter 7: Data Visualization with Python Libraries�������������������������������������������� 243


Technical requirements������������������������������������������������������������������������������������������������������������� 243
External files������������������������������������������������������������������������������������������������������������������������ 244
Commonly used plots���������������������������������������������������������������������������������������������������������������� 245
Matplotlib���������������������������������������������������������������������������������������������������������������������������������� 248
Approach for plotting using Matplotlib�������������������������������������������������������������������������������� 251
Plotting using Pandas��������������������������������������������������������������������������������������������������������������� 253
Scatter plot�������������������������������������������������������������������������������������������������������������������������� 254
Histogram���������������������������������������������������������������������������������������������������������������������������� 255
Pie charts���������������������������������������������������������������������������������������������������������������������������� 256
Seaborn library������������������������������������������������������������������������������������������������������������������������� 257
Box plots������������������������������������������������������������������������������������������������������������������������������ 258
Adding arguments to any Seaborn plotting function����������������������������������������������������������� 259
Kernel density estimate������������������������������������������������������������������������������������������������������� 259
Violin plot����������������������������������������������������������������������������������������������������������������������������� 260
Count plots�������������������������������������������������������������������������������������������������������������������������� 261
Heatmap������������������������������������������������������������������������������������������������������������������������������ 262
Facet grid���������������������������������������������������������������������������������������������������������������������������� 263
Regplot�������������������������������������������������������������������������������������������������������������������������������� 265

ix
Table of Contents

lmplot���������������������������������������������������������������������������������������������������������������������������������� 266
Strip plot������������������������������������������������������������������������������������������������������������������������������ 267
Swarm plot�������������������������������������������������������������������������������������������������������������������������� 268
Catplot��������������������������������������������������������������������������������������������������������������������������������� 269
Pair plot������������������������������������������������������������������������������������������������������������������������������� 270
Joint plot������������������������������������������������������������������������������������������������������������������������������ 272
Summary���������������������������������������������������������������������������������������������������������������������������������� 273
Review Exercises���������������������������������������������������������������������������������������������������������������������� 274

Chapter 8: Data Analysis Case Studies����������������������������������������������������������������� 279


Technical requirements������������������������������������������������������������������������������������������������������������� 279
Methodology����������������������������������������������������������������������������������������������������������������������������� 280
Case study 8-1: Highest grossing movies in France – analyzing unstructured data���������������� 281
Case study 8-2: Use of data analysis for air quality management�������������������������������������������� 288
Case study 8-3: Worldwide COVID-19 cases – an analysis������������������������������������������������������� 308
Summary���������������������������������������������������������������������������������������������������������������������������������� 320
Review Exercises���������������������������������������������������������������������������������������������������������������������� 321

Chapter 9: Statistics and Probability with Python����������������������������������������������� 325


Permutations and combinations����������������������������������������������������������������������������������������������� 325
Probability��������������������������������������������������������������������������������������������������������������������������������� 327
Rules of probability�������������������������������������������������������������������������������������������������������������� 328
Conditional probability��������������������������������������������������������������������������������������������������������� 330
Bayes theorem�������������������������������������������������������������������������������������������������������������������������� 330
Application of Bayes theorem in medical diagnostics��������������������������������������������������������� 331
Another application of Bayes theorem: Email spam classification�������������������������������������� 333
SciPy library������������������������������������������������������������������������������������������������������������������������������ 334
Probability distributions������������������������������������������������������������������������������������������������������������ 335
Binomial distribution����������������������������������������������������������������������������������������������������������� 335
Poisson distribution������������������������������������������������������������������������������������������������������������� 338
Continuous probability distributions������������������������������������������������������������������������������������ 341

x
Table of Contents

Normal distribution�������������������������������������������������������������������������������������������������������������� 341


Standard normal distribution����������������������������������������������������������������������������������������������� 343
Measures of central tendency��������������������������������������������������������������������������������������������������� 347
Measures of dispersion������������������������������������������������������������������������������������������������������������� 348
Measures of shape�������������������������������������������������������������������������������������������������������������������� 349
Sampling����������������������������������������������������������������������������������������������������������������������������������� 353
Probability sampling������������������������������������������������������������������������������������������������������������ 353
Non-probability sampling���������������������������������������������������������������������������������������������������� 354
Central limit theorem���������������������������������������������������������������������������������������������������������������� 355
Estimates and confidence intervals������������������������������������������������������������������������������������ 356
Types of errors in sampling������������������������������������������������������������������������������������������������������� 357
Hypothesis testing�������������������������������������������������������������������������������������������������������������������� 358
Basic concepts in hypothesis testing���������������������������������������������������������������������������������� 358
Key terminology used in hypothesis testing������������������������������������������������������������������������ 359
Steps involved in hypothesis testing����������������������������������������������������������������������������������� 361
One-sample z-test�������������������������������������������������������������������������������������������������������������������� 362
Two-sample sample z-test�������������������������������������������������������������������������������������������������������� 364
Hypothesis tests with proportions�������������������������������������������������������������������������������������������� 366
Two-sample z-test for the population proportions�������������������������������������������������������������� 368
T-distribution����������������������������������������������������������������������������������������������������������������������������� 370
One sample t-test���������������������������������������������������������������������������������������������������������������� 372
Two-sample t-test��������������������������������������������������������������������������������������������������������������� 372
Two-sample t-test for paired samples�������������������������������������������������������������������������������� 373
Solved examples: Conducting t-tests using Scipy functions���������������������������������������������������� 373
ANOVA��������������������������������������������������������������������������������������������������������������������������������������� 376
Chi-square test of association�������������������������������������������������������������������������������������������������� 379
Summary���������������������������������������������������������������������������������������������������������������������������������� 383
Review Exercises���������������������������������������������������������������������������������������������������������������������� 386

Index��������������������������������������������������������������������������������������������������������������������� 393

xi
About the Author
Gayathri Rajagopalan works for a leading Indian
multinational organization, with ten years of experience
in the software and information technology industry.
She has degrees in computer engineering and business
adminstration, and is a certified Project Management
Professional (PMP). Some of her key focus areas include
Python, data analytics, machine learning, statistics, and
deep learning. She is proficient in Python, Java, and C/C++
programming. Her hobbies include reading, music, and
teaching programming and data science to beginners.

xiii
About the Technical Reviewer
Manohar Swamynathan is a data science practitioner
and an avid programmer, with over 14 years of experience
in various data science related areas that include data
warehousing, Business Intelligence (BI), analytical tool
development, ad hoc analysis, predictive modeling, data
science product development, consulting, formulating
strategy, and executing analytics programs. He’s had a
career covering the life cycle of data across different
domains such as US mortgage banking, retail/ecommerce,
insurance, and industrial IoT. He has a bachelor’s degree
with a specialization in physics, mathematics, and
computers, and a master’s degree in project management. He’s currently living in
Bengaluru, the Silicon Valley of India.

xv
Acknowledgments
This book is a culmination of a year-long effort and would not have been possible
without my family’s support. I am indebted to them for their patience, kindness, and
encouragement.

I would also like to thank my readers for investing their time and money in this book. It is
my sincere hope that this book adds value to your learning experience.

xvii
Introduction
I had two main reasons for writing this book. When I first started learning data science,
I could not find a centralized overview of all the important topics on this subject.
A practitioner of data science needs to be proficient in at least one programming
language, learn the various aspects of data preparation and visualization, and also
be conversant with various aspects of statistics. The goal of this book is to provide
a consolidated resource that ties these interconnected disciplines together and
introduces these topics to the learner in a graded manner. Secondly, I wanted to provide
material to help readers appreciate the practical aspects of the seemingly abstract
concepts in data science, and also help them to be able to retain what they have learned.
There is a section on case studies to demonstrate how data analysis skills can be applied
to make informed decisions to solve real-world challenges. One of the highlights of
this book is the inclusion of practice questions and multiple-choice questions to help
readers practice and apply whatever they have learned. Most readers read a book and
then forget what they have read or learned, and the addition of these exercises will help
readers avoid this pitfall.

The book helps readers learn three important topics from scratch – the Python
programming language, data analysis, and statistics. It is a self-contained introduction
for anybody looking to start their journey with data analysis using Python, as it focuses
not just on theory and concepts but on practical applications and retention of concepts.
This book is meant for anybody interested in learning Python and Python-based libraries
like Pandas, Numpy, Scipy, and Matplotlib for descriptive data analysis, visualization,
and statistics. The broad categories of skills that readers learn from this book include
programming skills, analytical skills, and problem-solving skills.

The book is broadly divided into three parts – programming with Python, data analysis
and visualization, and statistics. The first part of the book comprises three chapters. It
starts with an introduction to Python – the syntax, functions, conditional statements,
data types, and different types of containers. Subsequently, we deal with advanced
concepts like regular expressions, handling of files, and solving mathematical problems

xix
Introduction

with Python. Python is covered in detail before moving on to data analysis to ensure that
the readers are comfortable with the programming language before they learn how to
use it for purposes of data analysis.

The second part of the book, comprising five chapters, covers the various aspects of
descriptive data analysis, data wrangling and visualization, and the respective Python
libraries used for each of these. There is an introductory chapter covering basic concepts
and terminology in data analysis, and one chapter each on NumPy (the scientific
computation library), Pandas (the data wrangling library), and the visualization
libraries (Matplotlib and Seaborn). A separate chapter is devoted to case studies to
help readers understand some real-world applications of data analysis. Among these
case studies is one on air pollution, using data drawn from an air quality monitoring
station in New Delhi, which has seen alarming levels of pollution in recent years. This
case study examines the trends and patterns of major air pollutants like sulfur dioxide,
nitrogen dioxide, and particulate matter for five years, and comes up with insights and
recommendations that would help with designing mitigation strategies.

The third section of this book focuses on statistics, elucidating important principles in
statistics that are relevant to data science. The topics covered include probability, Bayes
theorem, permutations and combinations, hypothesis testing (ANOVA, chi-­squared
test, z-test, and t-test), and the use of various functions in the Scipy library to enable
simplification of tedious calculations involved in statistics.

By the end of this book, the reader will be able to confidently write code in Python, use
various Python libraries and functions for analyzing any dataset, and understand basic
statistical concepts and tests. The code is presented in the form of Jupyter notebooks
that can further be adapted and extended. Readers get the opportunity to test their
understanding with a combination of multiple-choice and coding questions. They
also get an idea about how to use the skills and knowledge they have learned to make
evidence-based decisions for solving real-world problems with the help of case studies.

xx
CHAPTER 1

Getting Familiar
with Python
Python is an open source programming language created by a Dutch programmer
named Guido van Rossum. Named after the British comedy group Monty Python,
Python is a high-level, interpreted, open source language and is one of the most sought-
after and rapidly growing programming languages in the world today. It is also the
language of preference for data science and machine learning.

In this chapter, we first introduce the Jupyter notebook – a web application for running
code in Python. We then cover the basic concepts in Python, including data types,
operators, containers, functions, classes and file handling and exception handling, and
standards for writing code and modules.

The code examples for this book have been written using Python version 3.7.3 and
Anaconda version 4.7.10.

T echnical requirements
Anaconda is an open source platform used widely by Python programmers and data
scientists. Installing this platform installs Python, the Jupyter notebook application, and
hundreds of libraries. The following are the steps you need to follow for installing the
Anaconda distribution.

1. Open the following URL: https://www.anaconda.com/products/


individual

2. Click the installer for your operating system, as shown in Figure 1-1.
The installer gets downloaded to your system.

1
© Gayathri Rajagopalan 2021
G. Rajagopalan, A Python Data Analyst’s Toolkit, https://doi.org/10.1007/978-1-4842-6399-0_1
Chapter 1 Getting Familiar with Python

Figure 1-1. Installing Anaconda

3. Open the installer (file downloaded in the previous step) and run it.

4. After the installation is complete, open the Jupyter application


by typing “jupyter notebook” or “jupyter” in the explorer (search
bar) next to the start menu, as shown in Figure 1-2 (shown for
Windows OS).

Figure 1-2. Launching Jupyter

Please follow the following steps for downloading all the data files used in this book:

• Click the following link: https://github.com/DataRepo2019/


Data-files
• Select the green “Code” menu and click on “Download ZIP” from the
dropdown list of this menu
• Extract the files from the downloaded zip folder and import these
files into your Jupyter application

Now that we have installed and launched Jupyter, let us understand how to use this
application in the next section.

Getting started with Jupyter notebooks


Before we discuss the essentials of Jupyter notebooks, let us discuss what an integrated
development environment (or IDE) is. An IDE brings together the various activities
involved in programming, like including writing and editing code, debugging, and
2
Chapter 1 Getting Familiar with Python

creating executables. It also includes features like autocompletion (completing what


the user wants to type, thus enabling the user to focus on logic and problem-solving)
and syntax highlighting (highlighting the various elements and keywords of the
language). There are many IDEs for Python, apart from Jupyter, including Enthought
Canopy, Spyder, PyCharm, and Rodeo. There are several reasons for Jupyter becoming
a ubiquitous, de facto standard in the data science community. These include ease
of use and customization, support for several programming languages, platform
independence, facilitation of access to remote data, and the benefit of combining output,
code, and multimedia under one roof.

JupyterLab is the IDE for Jupyter notebooks. Jupyter notebooks are web applications that
run locally on a user’s machine. They can be used for loading, cleaning, analyzing, and
modeling data. You can add code, equations, images, and markdown text in a Jupyter
notebook. Jupyter notebooks serve the dual purpose of running your code as well as
serving as a platform for presenting and sharing your work with others. Let us look at the
various features of this application.

1. Opening the dashboard

Type “jupyter notebook” in the search bar next to the start menu.
This will open the Jupyter dashboard. The dashboard can be used
to create new notebooks or open an existing one.

2. Creating a new notebook

Create a new Jupyter notebook by selecting New from the upper


right corner of the Jupyter dashboard and then select Python 3
from the drop-down list that appears, as shown in Figure 1-3.

Figure 1-3. Creating a new Jupyter notebook

3. Entering and executing code

Click inside the first cell in your notebook and type a simple line
of code, as shown in Figure 1-4. Execute the code by selecting Run
Cells from the “Cell” menu, or use the shortcut keys Ctrl+Enter.
3
Chapter 1 Getting Familiar with Python

Figure 1-4. Simple code statement in a Jupyter cell

4. Adding markdown text or headings


In the new cell, change the formatting by selecting Markdown
as shown in Figure 1-5, or by pressing the keys Esc+M on your
keyboard. You can also add a heading to your Jupyter notebook by
selecting Heading from the drop-down list shown in the following
or pressing the shortcut keys Esc+(1/2/3/4).

Figure 1-5. Changing the mode to Markdown

5. Renaming a notebook
Click the default name of the notebook and type a new name, as
shown in Figure 1-6.

Figure 1-6. Changing the name of a file

You can also rename a notebook by selecting File ➤ Rename.


6. Saving a notebook
Press Ctrl+S or choose File ➤ Save and Checkpoint.
7. Downloading the notebook
You can email or share your notebook by downloading your
notebook using the option File ➤ Download as ➤ notebook
(.ipynb), as shown in Figure 1-7.
4
Chapter 1 Getting Familiar with Python

Figure 1-7. Downloading a Jupyter notebook

Shortcuts and other features in Jupyter


Let us look at some key features of Jupyter notebooks, including shortcuts, tab
completions, and magic commands.

Table 1-1 gives some of the familiar icons found in Jupyter notebooks, the corresponding
menu functions, and the keyboard shortcuts.

5
Chapter 1 Getting Familiar with Python

Table 1-1. Jupyter Notebook Toolbar Functions


Icon in Toolbar Function Keyboard shortcut Menu function

Saving a Jupyter notebook Esc+s File ➤ Save as

Adding a new cell to a Esc+b (adding a cell below the Insert ➤ Insert Cell
Jupyter notebook current cell), or Esc+a (adding Above or Insert ➤
a cell above the current cell) Insert Cell Below

Cutting a selected cell Esc+x Edit ➤ Cut Cells

Copying the selected cell Esc+c Edit ➤ Copy Cells

Pasting a cell above or Esc+v Edit ➤ Paste Cells


below another selected cell Above or Edit ➤
Paste Cells Below

Running a given cell Ctrl+Enter (to run selected cell); Cell ➤ Run
Shift+Enter (to run selected cell Selected Cells
and insert a new cell)

Interrupting the kernel Esc+ii Kernel ➤ Interrupt

Rebooting the kernel Esc+00 Kernel ➤ Restart

If you are not sure about which keyboard shortcut to use, go to: Help ➤ Keyboard
Shortcuts, as shown in Figure 1-8.

Figure 1-8. Help menu in Jupyter


6
Chapter 1 Getting Familiar with Python

Commonly used keyboard shortcuts include

• Shift+Enter to run the code in the current cell and move to the next
cell.

• Esc to leave a cell.

• Esc+M changes the mode for a cell to “Markdown” mode.

• Esc+Y changes the mode for a cell to “Code”.

T ab Completion
This is a feature that can be used in Jupyter notebooks to help you complete the code
being written. Usage of tab completions can speed up the workflow, reduce bugs, and
quickly complete function names, thus reducing typos and saving you from having to
remember the names of all the modules and functions.

For example, if you want to import the Matplotlib library but don’t remember the
spelling, you could type the first three letters, mat, and press Tab. You would see a drop-
down list, as shown in Figure 1-9. The correct name of the library is the second name in
the drop-down list.

Figure 1-9. Tab completion in Jupyter

Magic commands used in Jupyter


Magic commands are special commands that start with one or more % signs, followed by
a command. The commands that start with one % symbol are applicable for a single line
of code, and those beginning with two % signs are applicable for the entire cell (all lines
of code within a cell).

7
Chapter 1 Getting Familiar with Python

One commonly used magic command, shown in the following, is used to display
Matplotlib graphs inside the notebook. Adding this magic command avoids the need
to call the plt.show function separately for showing graphs (the Matplotlib library is
discussed in detail in Chapter 7).

CODE:

%matplotlib inline

Magic commands, like timeit, can also be used to time the execution of a script, as shown
in the following.

CODE:

%%timeit
for i in range(100000):
    i*i

Output:

16.1 ms ± 283 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)

Now that you understand the basics of using Jupyter notebooks, let us get started with
Python and understand the core aspects of this language.

P
 ython Basics
In this section, we get familiar with the syntax of Python, commenting, conditional
statements, loops, and functions.

Comments, print, and input


In this section, we cover some basics like printing, obtaining input from the user, and
adding comments to help others understand your code.

C
 omments
A comment explains what a line of code does, and is used by programmers to help others
understand the code they have written. In Python, a comment starts with the # symbol.

8
Chapter 1 Getting Familiar with Python

Proper spacing and indentation are critical in Python. While other languages like Java
and C++ use brackets to enclose blocks of code, Python uses an indent of four spaces
to specify code blocks. One needs to take care of indents to avoid errors. Applications
like Jupyter generally take care of indentation and automatically add four spaces at the
beginning of a block of code.

Printing
The print function prints content to the screen or any other output device.

Generally, we pass a combination of strings and variables as arguments to the print


function. Arguments are the values included within the parenthesis of a function, which
the function uses for producing the result. In the following statement, “Hello!” is the
argument to the print function.

CODE:

print("Hello!")

To print multiple lines of code, we use triple quotes at the beginning and end of the
string, for example:

CODE:

print('''Today is a lovely day.


It will be warm and sunny.
It is ideal for hiking.''')

Output:

Today is a lovely day.


It will be warm and sunny.
It is ideal for hiking.

Note that we do not use semicolons in Python to end statements, unlike some other
languages.

The format method can be used in conjunction with the print method for embedding
variables within a string. It uses curly braces as placeholders for variables that are passed
as arguments to the method.

Let us look at a simple example where we print variables using the format method.
9
Chapter 1 Getting Familiar with Python

CODE:

weight=4.5
name="Simi"
print("The weight of {} is {}".format(name,weight))

Output:

The weight of Simi is 4.5

The preceding statement can also be rewritten as follows without the format method:

CODE:

print("The weight of",name,"is","weight")

Note that only the string portion of the print argument is enclosed within quotes. The name
of the variable does not come within quotes. Similarly, if you have any constants in your
print arguments, they also do not come within quotes. In the following example, a Boolean
constant (True), an integer constant (1), and strings are combined in a print statement.

CODE:

print("The integer equivalent of",True,"is",1)

Output:

The integer equivalent of True is 1

The format fields can specify precision for floating-point numbers. Floating-point
numbers are numbers with decimal points, and the number of digits after the decimal
point can be specified using format fields as follows.

CODE:

x=91.234566
print("The value of x upto 3 decimal points is {:.3f}".format(x))

Output:

The value of x upto 3 decimal points is 91.235

We can specify the position of the variables passed to the method. In this example, we
use position “1” to refer to the second object in the argument list, and position “0” to
specify the first object in the argument list.
10
Chapter 1 Getting Familiar with Python

CODE:

y='Jack'
x='Jill'
print("{1} and {0} went up the hill to fetch a pail of water".format(x,y))

Output:

Jack and Jill went up the hill to fetch a pail of water

I nput
The input function accepts inputs from the user. The input provided by the user is stored
as a variable of type String. If you want to do any mathematical calculations with any
numeric input, you need to change the data type of the input to int or float, as follows.

CODE:

age=input("Enter your age:")


print("In 2010, you were",int(age)-10,"years old")

Output:

Enter your age:76


In 2010, you were 66 years old

Further reading on Input/Output in Python: https://docs.python.org/3/tutorial/


inputoutput.html

V
 ariables and Constants
A constant or a literal is a value that does not change, while a variable contains a value
can be changed. We do not have to declare a variable in Python, that is, specify its data
type, unlike other languages like Java and C/C++. We define it by giving the variable a
name and assigning it a value. Based on the value, a data type is automatically assigned
to it. Values are stored in variables using the assignment operator (=). The rules for
naming a variable in Python are as follows:
• a variable name cannot have spaces

• a variable cannot start with a number

11
Chapter 1 Getting Familiar with Python

• a variable name can contain only letters, numbers, and underscore


signs (_)

• a variable cannot take the name of a reserved keyword (for example,


words like class, continue, break, print, etc., which are predefined
terms in the Python language, have special meanings, and are invalid
as variable names)

Operators
The following are some commonly used operators in Python.

Arithmetic operators: Take two integer or float values, perform an operation, and return
a value.

The following arithmetic operators are supported in Python:

• **(Exponent)

• %(modulo or remainder),

• //(quotient),

• *(multiplication)

• -(subtraction)

• +(addition)

The order of operations is essential. Parenthesis takes precedence over exponents,


which takes precedence over division and multiplication, which takes precedence
over addition and subtraction. An acronym was designed - P.E.D.M.A.S.(Please Excuse
My Dear Aunt Sally) - that can be used to remember the order of these operations to
understand which operator first needs to be applied in an arithmetic expression. An
example is given in the following:

CODE:

(1+9)/2-3

Output:

2.0

12
Chapter 1 Getting Familiar with Python

In the preceding expression, the operation inside the parenthesis is performed first,
which gives 10, followed by division, which gives 5, and then subtraction, which gives the
final output as 2.

Comparison operators: These operators compare two values and evaluate to a true or
false value. The following comparison operators are supported in Python:
• >: Greater than
• < : Less than
• <=: Less than or equal to
• >=: Greater than or equal to
• == : equality. Please note that this is different from the assignment
operator (=)
• !=(not equal to)

Logical (or Boolean) operators: Are similar to comparison operators in that they
also evaluate to a true or false value. These operators operate on Boolean variables or
expressions. The following logical operators are supported in Python:

• and operator: An expression in which this operator is used evaluates


to True only if all its subexpressions are True. Otherwise, if any of
them is False, the expression evaluates to False
An example of the usage of the and operator is shown in the following.
CODE:

(2>1) and (1>3)

Output:

False

• or operator: An expression in which the or operator is used, evaluates


to True if any one of the subexpressions within the expression is True.
The expression evaluates to False if all its subexpressions evaluate to
False.
An example of the usage of the or operator is shown in the following.

CODE:

(2>1) or (1>3)
13
Random documents with unrelated
content Scribd suggests to you:
After various improvements had been introduced in the poor law at
Strasburg subsequent to 1500, the magistrates—the clergy and the
monasteries not having shown themselves equal to their task—issued a
new enactment, though even this relied to a great extent on the help of
the clergy. The regulations of Augsburg and Nuremberg were the most
effectual. It was only later, after the work of Capito, Bucer and Hedio at
Strasburg, that, together with the new spirit, changes crept into the
traditional poor-law system of the town.
All the enactments, dating from late mediæval times prior to the
religious innovations, for the poor of the other great German towns,
for instance, of Ratisbon (1523), Breslau (1525) and Würzburg
(1533) are of a more or less similar character. Thus, thanks to the
economic pressure, there was gradually evolved, in the centres of
German prosperity and commercial industry, a sober but practical
and far-sighted poor-law system.[139]
It was not, indeed, so easy to get rid of the existing disorders; to
achieve this a lengthy struggle backed by the regulations just
established would have been necessary. Above all, the tramps and
vagabonds, who delighted in idleness and adventure and who often
developed dangerous proclivities, continued to be the pest of the
land. The cause of this economic disorder was a deep-seated one
and entirely escapes those who declare that beggary sprang solely
from the idea foisted on the Church, viz. that “poverty was
meritorious and begging a respectable trade.”

Luther’s Efforts. The Primary Cause of their Failure

The spread of Lutheranism had its effect on the municipal


movement for the relief of the poor, nor was its influence all for the
good.
In 1528 and 1529 Luther twice published an edition of the booklet
“On the Roguery of the False Beggars” (“Liber vagatorum”), a work
dating from the beginning of the 16th century; in his preface to it he
says, that the increase in fraudulent vagrancy shows “how strong in
the world is the rule of the devil”; “Princes, lords, town-magistrates
and, in fact, everybody” ought to see that alms were bestowed only
on the beggars and the needy in their own neighbourhood, not on
“rogues and vagabonds” by whom even he himself (Luther) had
often been taken in. Everywhere in both towns and villages registers
should be kept of the poor, and strange beggars not allowed without
a “letter or testimonial.”[140]
He was, however, not always so circumspect in his demands and
principles. In a passage of his work “An den Adel” he makes a wild
appeal, which in its practicability falls short of what had already been
done in various parts of Germany. The only really new point in it is,
that, in order to make an end of begging and poverty, the mendicant
Orders should be abolished, and the Roman See deprived of their
collections and revenues. Of the ordinary beggars he says, without
being sufficiently acquainted with the state of the case, that they
“might easily be expelled,” and that it would be an “easy matter to
deal with them were we only brave and in earnest enough.” To the
objection that the result of violent measures would be a still more
niggardly treatment of the poor he replied in 1520: “It suffices that
the poor be fairly well provided for, so that they die not of hunger or
cold.” With a touch of communism he exaggerates, at the expense of
the well-to-do and those who did no work, an idea in itself
undoubtedly true, viz. that work is man’s portion: “It is not just that,
at the expense of another’s toil, a man should go idle, wallow in
riches and lead a bad life, whilst his fellow lives in destitution, as is
now the perverted custom.… It was never ordained by God that
anyone should live on the goods of another.”[141]
In itself it could only have a salutary effect when Luther goes on
to speak, as he frequently does, against begging among the class
whose duty it was to work with their hands, and when he attempts
both to check their idleness and to rouse a spirit of charity towards
the deserving.[142] He even regards the Bible text, “Let there be no
beggar or starving person amongst you,” as universally binding on
Christians. Only that he is oblivious of the necessary limitations
when he exclaims: “If God commanded this even in the Old
Testament how much more is it incumbent on us Christians not to let
anyone beg or starve!”[143]
The latter words refer to those who are really poor but quite
willing to work (a class of people which will always exist in spite of
every effort); as for those who “merely eat” he demands that they
be driven out of the land. This he does in a writing of 1526
addressed to military men; here he divides “all man’s work into two
kinds,” viz. “agricultural work and war work.” A third kind of work,
viz. the teaching office, to which he often refers elsewhere, is here
passed over in silence. “As for the useless people,” he cries, “who
serve neither to defend us nor to feed us, but merely eat and pass
away their time in idleness, [the Emperor or the local sovereign]
should either expel them from the land or make them work, as the
bees do, who sting to death the drones that do not work but devour
the honey of the others.”[144] His unmethodical mind failed to see to
what dire consequences these hastily penned words could lead.
With the object of alleviating poverty he himself, however, lent a
hand to certain charitable institutions, which, though they did not
endure, have yet their place in history. Such were the poor-boxes of
Wittenberg, Leisnig, Altenburg and some other townships. This
institution was closely bound up with his scheme of gathering
together the “believing Christians” into communities apart. These
communities were not only to have their own form of divine worship
and to use the ecclesiastical penalties, but were also to assist the
poor by means of the common funds in a new and truly Evangelical
fashion.
The olden poor-law ordinances of mediæval times had been
revised at Wittenberg and embodied in the so-called
“Beutelordnung.”[145] Carlstadt and the town-council, under the
influence of Luther’s earlier ideas, substituted for this on Jan. 24,
1522, a new “Order for the princely town of Wittenberg”; at the
same time they reorganised the common funds.[146] These
regulations Luther left in force, when, on his return from the
Wartburg, he annulled the rest of Carlstadt’s doings; the truth is,
that they were not at variance even with his newer ideals.
In 1523 he himself promoted a similar but more highly developed
institution for the relief of the poor in the little Saxon town of Leisnig
on the Freiberg Mulde; this was to be in the hands of the community
of true believers into which the inhabitants had formed themselves
at the instigation of the zealous Lutheran, Sebastian von Kötteritz. At
Altenburg also, doubtless through Luther’s doing, his friend
Wenceslaus Link, the preacher in that town, made a somewhat
similar attempt to establish a communal poor-box. In many other
places efforts of a like nature were made under Lutheran auspices.
How far such undertakings spread throughout the Protestant
congregations cannot be accurately determined. We know, however,
the details of the scheme owing to our still having the rules drawn
up for Leisnig.[147]
According to this the whole congregation, town-councillors, aldermen,
elders and all the inhabitants generally, were to bind themselves to make
a good use of their Christian freedom by the faithful keeping of the Word
of God and by submitting to good discipline and just penalties. Ten coffer-
masters were to be appointed over the “common fund” and these were
three times a year to give an account to the “whole assembly thereto
convened.” Into this fund was to be put not merely the revenue of the
earlier institutions which hitherto had been most active in the relief of the
poor, viz. the brotherhoods and benevolent associations, as also that of
most of the guilds, and, moreover, the whole income drawn by the parish
from the glebes, pious foundations, tithes, voluntary offerings, fines,
bridge dues and private industrial concerns. Thus it was not merely a
relief fund but practically a trust comprising all the wealth of the
congregation, which chiefly consisted in the extensive Church property it
had annexed. In keeping with this is the manner in which the income was
to be apportioned. Only a part was devoted to the relief of the poor, i.e. to
the hospital, orphanage and guest-houses. Most of the money was to go
to defray the stipend of the Lutheran pastor and his clerk, to maintain the
schools and the church, and to allow of advances being made to artisans
free of interest; the rest was to be put by for times of scarcity. The
members of the congregation were also exhorted to make contributions
out of charity to their neighbour.
The scheme pleased Luther so well that he advised the printing of the
rules, and himself wrote a preface to the published text in which he said,
he hoped that “the example thus set would prove a success, be generally
followed, and lead to a great ruin of the earlier foundations, monasteries,
chapels and all other such abominations which hitherto had absorbed all
the world’s wealth under a show of worship.”
Hence here once more his chief motive is a polemical one, viz. his
desire to injure Popery.
He invites the authorities on this occasion to “lay hands on” such
property and to apply to the common fund all that remained over after the
obligations attaching to the property had been complied with, and
restitution made to such heirs of the donors as demanded it on account of
their poverty. In giving this advice he was anxious, as he says, to disclaim
any responsibility in the event of “such property as had fallen vacant being
plundered owing to the estates changing hands and each one laying hold
on whatever he could seize.” “Should avarice find an entry what then can
be done? It must not indeed be given up in despair. It is better that
avarice should take too much in a legal way than that there should be
such plundering as occurred in Bohemia. Let each one [i.e. of the heirs of
the donors] examine his own conscience and see what he ought to take
for his own needs and what he should leave for the common fund!”[148]
The setting up of such a “common fund” was also suggested in other
Lutheran towns as a means of introducing some sort of order into the
confiscation of the Church’s property. The direct object of the funds was
not the relief of the poor. This was merely included as a measure for
palliating and justifying the bold stroke which the innovators were about
to take in secularising the whole of the Church’s vast properties.
This, however, makes some of Luther’s admonitions in his preface to the
regulations for the Leisnig common fund sound somewhat strange, for
instance, his injunction that everything be carried out according to the law
of love. “Christian charity must here act and decide; laws and enactments
cannot settle the difficulties. Indeed I write this counsel only out of
Christian charity for the Christians.” Whoever refuses to accept his advice,
he says at the conclusion, may go his own way; only a few would accept
it, but one or two were quite enough for him. “The world must remain the
world and Satan its Prince. I have done what I could and what it was my
duty to do.” He was half conscious of the unpractical character of his
proposals, yet any failure he was determined to attribute to the devil’s
doing.
His premonition of failure was only too soon realised at Leisnig.
The new scheme could not be made to work. The magistrates
refused to resign the rights they claimed of disposing of the
foundations and similar charitable sources of revenue or to hand
over the incomings to the coffer-masters, for the latter, they argued,
were representatives, not of the congregation but of the Church.
Hence the fund had to go begging. Luther came to words with the
town-council, but was unable to have his own way, even though he
appealed to the Elector.[149] He lamented in 1524 that the example
of Leisnig had been a very sad one, though, as the first of its kind,
[150] it should have served as a model. Of Tileman Schnabel, an ex-
Augustinian and college friend of Luther’s at Erfurt, who had been
working at Leisnig as preacher and “deacon,” Luther wrote, that he
would soon find himself obliged to leave if he did not wish to die of
hunger. “Incidents such as these deprive the parsonages of their
best managers. Maybe they want to drive them back to their old
monasteries.”[151]
Thus the parochial fund of Leisnig, which some writers have
extolled so highly, really never came into existence. It lives only in
the directions given by Luther.
So ill were parson and schoolmaster cared for at Leisnig, in spite
of all the Church property that had been sequestered, that,
according to the Visitation of 1529, the preacher there had been
obliged to ply a trade and gain a living by selling beer. In 1534, so
the records of the Visitations of that date declare, the schoolmaster
had for five years been paid no salary.
Link, the Altenburg preacher, was also unsuccessful in his efforts
to carry out a similar scheme. He complained as early as 1523, in a
writing entitled “Von Arbeyt und Betteln,” that this Christian
undertaking had so far “not only not been furthered but had actually
gone backward” in spite of all his efforts from the pulpit. He, too,
addresses himself to the “rulers” and reminds them that it is their
duty “to the best of their ability to provide for the poverty of the
masses.”[152]
To Luther’s bitter grief and disappointment Wittenberg (see above,
p. 49) also furnished anything but an encouraging example. Here the
incentive to the introduction of the common fund by Carlstadt had
been the resolve of the town council “to seize on the revenues of the
Church, the brotherhoods and guilds and divert them into the
common fund, to be employed for general purposes, and for paying
the Church officials.… No less than twenty-one pious guilds were to
be mulcted.”[153] Yet the Wittenberg measures were so little a
success, in spite of all Luther’s efforts, that in his sermons he could
not sufficiently deplore the absence of charity and prevalence of
avarice and greed amongst both burghers and councillors.[154] The
Beutelordnung continued indeed in existence, but merely as an
administrative department of the town council.
It is not surprising therefore that Luther gave up for the while any
attempt at putting into practice the Leisnig project elsewhere; his
scheme for assembling the true Christians into a community had also
perforce to betake itself unto the land of dreams. Only in his
“Deudsche Messe” of 1526 does the old idea again force itself to the
front: “Here a general collection for the poor might be made among
the congregation; it should be given willingly and distributed
amongst the needy after the example of St. Paul, 2 Cor. ix.… If only
we had people earnestly desirous of being Christians, the manner
and order would soon be settled.”[155]
Subsequent to 1526, however, Bugenhagen drafted better
regulations and poor laws for Wittenberg and other Protestant
towns, founded this time on a more practical basis. (See below, p.
57 f.)
Luther, nevertheless, continued to complain of the Wittenbergers.
The indignation he expresses at the lack of all charitable endeavours
throughout the domain of the new Evangel serves as a suitable
background for these complaints.
Want of charity and of neighbourly love was the primary and most
important cause of the failure of Luther’s efforts.
“Formerly, when people served the devil and outraged the Blood of
Christ,” he says in 1530 in “Das man die Kinder zur Schulen halten solle”
(see above, p. 6), “all purses were open and there was no end to the
giving, for churches, schools and every kind of abomination; but now that
it is a question of founding true schools and churches every purse is
closed with iron chains and no one is able to give.” So pitiful a sight made
him beg of God a happy death so that he might not live to see Germany’s
punishment: “Did my conscience allow of it I would even give my help and
advice so as to bring back the Pope with all his abominations to rule over
us once more.”[156]
What leads him to such admissions as, that, the Christians, “under the
plea of freedom are now seven times worse than they were under the
Pope’s tyranny,” is, in the first place, his bitter experience of the drying up
of charity, which now ceases to care even for the parsonages and
churches. Under the Papacy people had been eager to build churches and
to make offerings to be distributed in alms among the poor, but, now that
the true religion is taught, it is a wonder how everyone has grown so cold.
—Yet the people were told and admonished that it was well pleasing to
God and all the angels, but even so they would not respond.—Now a
pastor could not even get a hole in his roof mended to enable him to lie
dry, whereas in former days people could erect churches and monasteries
regardless of cost.—“Now there is not a single town ready to support a
preacher and there is nothing but robbery and pilfering amongst the
people and no one hinders them. Whence comes this shameful plague?
‘From the doctrine,’ say the bawlers, ‘which you teach, viz. that we must
not reckon on works or place our trust in them.’ This is, however, the work
of the tiresome devil who falsely attributes such things to the pure and
wholesome teaching,” etc.[157]
He is so far from laying the blame on his teaching that he exclaims:
What would our forefathers, who were noted for their charity, not have
done “had they had the light of the Evangel which is now given to us”?
Again and again he comes back to the contrast between his and older
times: “Our parents and forefathers put us to shame for they gave so
generously and charitably, nay even to excess, to the churches,
parsonages and schools, foundations, hospitals,” etc.[158]—“Indeed had
we not already the means, thanks to the charitable alms and foundations
of our forefathers, the Gospel itself would long since have been wiped out
by the burghers in the towns, and the nobles and peasants in the country,
so that not one poor preacher would have enough to eat and drink; for we
refuse to supply them, and, instead, rob and lay violent hands on what
others have given and founded for the purpose.”[159]
To sum up briefly other characteristic complaints which belong here, he
says: Now that in accordance with the true Evangel we are admonished
“to give without seeking for honour or merit, no one can spare a
farthing.”[160]—No one now will give, and, “unless we had the lands we
stole from the Pope, the preachers would have but scant fare”; they even
try “to snatch the morsels out of the parson’s mouth.” The way in which
the “nobles and officials” now treat what was formerly Church property
amounts to “a devouring of all beggars, strangers and poor widows; we
may indeed bewail this, for they eat up the very marrow of the bones.
Since they raise a hue and cry against the Papists let them also not forget
us.… Woe to you peasants, burghers and nobles who grab everything,
hoard and scrape, and pretend all the time to be good Evangelicals.”[161]
He is only too well acquainted with the evils of mendicancy and
idleness, and knows that they have not diminished but rather increased.
Even towards the end of his life he alludes to the “innumerable wicked
rogues who pretend to be poor, needy beggars and deceive the people”;
they deserve the gallows as much as the “idlers,” of whom there are “even
many more” than before, who are well able to work, take service and
support themselves, but prefer to ask for alms, and, “when these are not
esteemed enough, to supplement them by pilfering or even by open,
bare-faced stealing in the courtyards, the streets and in the very houses,
so that I do not know whether there has ever been a time when robbery
and thieving were so common.”[162]
Finally he recalls the enactments against begging by which the
“authorities forbade foreign beggars and vagabonds and also idlers.”
This brings us back to the attempts made, with the consent of the
authorities in the Lutheran districts, to obviate the social evils by
means similar to those adopted at Leisnig.

A Second Stumbling Block: Lack of Organisation


It was not merely lack of charity that rendered nugatory all
attempts to put in force regulations such as those drafted for
Leisnig, but also defects in the inner organisation of the schemes.
First, to lump all sorts of monies intended for different purposes into
a single fund could prove nothing but a source of confusion and
diminish the amount to be devoted directly to charitable purposes;
this, too, was the effect of keeping no separate account of the
expenditure for the relief of the poor.
Then, again, the intermingling of secular and spiritual which the
arrangement involved was very unsatisfactory. We can trace here
more clearly than elsewhere the quasi-mystic idea of the
congregation of true believers which retained so strong a hold on
Luther’s imagination till about 1525. With singular ignorance of the
ways of the world he wished to set up the common fund on a
community based on faith and charity in which the universal
priesthood was supposed to have abolished all distinction between
the spiritual and secular authorities, nay, between the two very
spheres themselves. He took for granted that Evangelical rulers
would be altogether spiritual simply because they possessed the
faith; faith, so he seemed to believe, would of itself do everything in
the members of the congregation; under the guidance of the spirit
everything would be “held in common, after the example of the
Apostles,” as he says in the preface of the Leisnig regulations. But
what was possible of accomplishment owing to abundance of grace
in Apostolic times was an impossible dream in the 16th century. “The
old ideal of an ecclesiastical commonwealth on which, according to
the preface, Luther wished to construct a kind of insurance society
for the relief of the poor, could not subsist for a moment in the keen
atmosphere of a workaday world where men are what they are.”[163]
Hence the latest writer on social politics and the poor law, from
whom the above words are taken, openly expresses his wonder at
the “utopian, religio-communistic foundation on which the
Wittenberg and Leisnig schemes, and those drawn up on similar
lines, were based,” at the “utopian efforts” with their “absurd system
of expenditure,” which, owing to their “fundamental defects and the
mixing of the funds, were doomed sooner or later to fail.” This
“travesty of early Christianity” tended neither to promote the moral
and charitable sense of the people nor to further benevolent
organisation. “Any rational policy of poor law” was, on the contrary,
shut out by these early Lutheran institutions; the relief of the poor
was thereby placed on an “eminently unstable basis”; the poor-
boxes only served “to encourage idleness.” “Not in such a way could
the modern poor-law system, based as it is on impersonal, legal
principles, be called into being.”
“No system of poor law has ever had less claim to be placed at the
head of a new development than this one [of Leisnig].”[164]
The years 1525 and 1526 brought the turning point in Luther’s
attitude towards the question of poor relief, particularly owing to the
effect of the Peasant War on his views of society and the Church.
The result of the war was to bring the new religious system into
much closer touch with the sovereigns and “thus practically to give
rise to a theocracy.”[165] In spite of the changes this produced,
Luther’s schemes for providing for the poor continued to display
some notable defects.
For all “practical purposes Luther threw over the principle of the
universal priesthood which the peasants had embraced as a socio-political
maxim, and, by a determined effort, cut his cause adrift from the social
efforts of the day.… He worked himself up into a real hatred of the mob,
of ‘Master Omnes,’ the ‘many-headed monster,’ and indeed came within an
ace of the socio-political ideas of Machiavelli, who advised the rulers to
treat the people so harshly that they might look upon those lords as
liberal who were not extortionate.” After the abrogation of episcopal
authority and canon law, of hierarchy and monasteries “there came an
urgent call for the establishment of new associations with practical aims
and for the construction of the skeleton of the new Christian community;
we now hear no more of that ideal community of true believers which,
thanks to its heartfelt faith, was to carry on the social work of preventing
and alleviating poverty.”
The whole of the outward life of the Church being now under the
direction of the Protestant sovereign, the system of poor relief began
to assume a purely secular character, having nothing but an outward
semblance of religion. The new regulations were largely the work of
Bugenhagen, who was a better organiser than Luther. The many
enactments he was instrumental in drafting for the North German
towns embody necessary provisions for the relief of the poor.
Officials appointed by the sovereign or town-council directed, or at
least supervised, the management, while the “deacons,” i.e. the
ecclesiastical guardians of the fund, were obliged to find the
necessary money and, generally, to bear all the odium for the
meagreness and backwardness of the distribution. The members of
the congregation had practically no longer any say in the matter. The
parish’s share in the relief of the poor was made an end of even
before it had lost the other similar rights assigned to it by Luther,
such as that of promulgating measures of discipline, appointing
clergy, administering the Church’s lands, etc. Just as the organisation
of the Church was solely in the hands of the authorities to the
complete exclusion of the congregations, so poor relief and the
ecclesiastical regulations on which it was based became merely a
government concern.
What Bugenhagen achieved, thanks to the ecclesiastical
regulations for poor relief, for which he was directly or indirectly
responsible, gave “good hopes, at least at first, of bringing the
difficult social problem of those days nearer to a solution.” At any
rate they were a “successful attempt to bring some order into the
whole system of relief, by means of the authorities and on a scale
not hitherto attempted by the Church.”[166] It is true that he, like
those who were working on the same lines, e.g. Hedio, Rhegius,
Hyperius, Lasco and others, often merely transplanted into a new
soil the rules already in vogue in the Catholic Netherlands and the
prosperous South German towns. Hedio of Strasburg, for instance,
translated into German the entire work of Vives, the opponent of
Lutheranism, and exploited it practically and also sought to enter
into epistolary communication with Vives. The prohibition of
mendicancy, the establishment of an independent poor-box apart
from the rest of the Church funds, and many other points were
borrowed by Bugenhagen and others from the olden Catholic
regulations.
Such efforts were in many localities supplemented by the
kindliness of the population and, thanks to a spirit of Christianity,
were not without fruit.
As, however, everybody, Princes, nobles, townships and peasants,
were stretching out greedy hands towards the now defenceless
possessions of the olden Church, a certain reaction came, and the
State, in the interests of order, saw fit to grant a somewhat larger
share to the ecclesiastical authorities in the administration of Church
property and relief funds. The Lutheran clergy and the guardians of
the poor were thus allowed a certain measure of free action,
provided always that what they did was done in the name of the
sovereign, i.e. the principal bishop. The new institutions created by
such men as Bugenhagen soon lost their public, communal or State
character, and sank back to the level of ecclesiastical enterprises.
Institutions of this stamp had, however, “been more numerous and
better endowed in the Middle Ages and were so later in the Catholic
districts.”
Owing in part to a technical defect in the Protestant regulations,
dishonesty and carelessness were not excluded from the
management and distribution of the poor fund, the administration
falling, as a matter of course, into the hands of the lowest class of
officials. Catholics had good reason for branding it as a “usury and
parson’s box.”[167] The reason why, in Germany, Protestant efforts
for poor relief never issued in a satisfactory socio-political system
capable of relieving the poor and thus improving the condition of
both Church and State, lay, not merely in the economic difficulties of
the time, but, “what is more important, in the social and moral
working of the new religion and new piety which Luther had
established.”[168]
Influence of Luther’s Ethics. Robbery of Church Property
Proves a Curse

Not only had the Peasant Rising and the reprisals taken by the
rulers and the towns brought misery on the land and hardened the
hearts of the princes and magistrates, not only had the means
available for the relief of the poor been diminished, first by the
founding of new parishes in place of the old ones, which had in
many cases been supported by the monasteries and foundations,
secondly, by the demands of Protestants for the restitution of many
ecclesiastical benefices given by their Catholic forefathers, thirdly, by
the drying up of the spring of gifts and donations, but “the common
fund, which had been swelled by the shekels of the Church, had now
to bear many new burdens and only what remained—which often
enough was not much—was employed for charitable purposes.” In
the same way, and to an even greater extent, must the Lutheran
ethics be taken into account. Luther’s views on justification by faith
alone destroyed “that impulse of the Middle Ages towards open-
handed charity.” This was “an ethical defect of the Lutheran
doctrine”; it was only owing to his “utter ignorance of the world”
that Luther persisted in believing that faith would, of itself and
without any “law,” beget good works and charity.[169] “It was a
cause of wonder and anxiety to him throughout his life that his
assumption, that faith would be the best ‘taskmaster and the
strongest incentive to good works and kindliness,’ never seemed to
be realised.… The most notable result of Luther’s doctrine of grace
and denial of all human merit was, at least among the masses, an
increase of libertinism and of the spirit of irresponsibility.”[170]
The dire effects of the new principles were also evident in the
large and wealthy towns, the exemplary poor-law regulations of
which we have considered above. After the innovations had made
their way among them we hear little more of provisions being made
against mendicancy, for the promotion of work and for the relief of
poverty. Hence, as regards these corporations … the change of
religion meant, according to Feuchtwanger, “a decline in the quality
of their social philanthropy.” (Cp. above, vol. iv., p. 477 ff.)
From some districts, however, we have better reports of the
results achieved by the relief funds. In times of worst distress good
Christians were always ready to help. Much depended on the spirit
of those concerned in the work. In general, however, the complaints
of the preachers of the new faith, including Melanchthon, wax louder
and louder.[171] They tell us that the patrimony of the poor was
being carried off by the rapacity of the great or disappearing under
the hands of avaricious and careless administrators, whilst new
voluntary contributions were no longer forthcoming. We find no lack
of those, who, like Luther’s friend Paul Eber, are given to noting the
visible, palpable consequences of the wrong done to the
monasteries, brotherhoods and churches.[172]
A long list of statements from respected Protestant contemporaries is
given by Janssen, who concludes: “The whole system of poor relief was
grievously affected by the seizure and squandering of Church goods and
of innumerable charitable bequests intended not only for parochial and
Church use but also for the hospitals, schools and poor-houses.”[173] The
testimonies in question, the frankness of which can only be explained by
the honourable desire to make an end of the crying evil, come, for
instance, from Thomas Rorarius, Andreas Musculus, Johann Winistede,
Erasmus Sarcerius, Ambrose Pape and the General Superintendent,
Cunemann Flinsbach.[174] They tend to show that the new doctrine of
faith alone had dried up the well-spring of self-sacrifice, as indeed
Andreas Hyperius, the Marburg theologian, Christopher Fischer, the
General Superintendent, Daniel Greser, the Superintendent, Sixtus Vischer
and others state in so many words.
The incredible squandering of Church property is proved by official
papers, was pilloried by the professors of the University of Rostock, also is
clear from the minutes of the Visitations of Wesenberg in 1568 and of the
Palatinate in 1556 which bewail “the sin against the property set aside for
God and His Church.”[175] And again, “The present owners have dealt
with the Church property a thousand times worse than the Papists,” they
make no conscience of “selling it, mortgaging it and giving it away.”
Princes belonging to the new faith also raised their voice in protest, for
instance, Duke Barnim XI in 1540, Elector Joachim II of Brandenburg in
1540 and Elector Johann George, 1573. But the sovereigns were unable to
restrain their rapacious nobles. “The great Lords,” the preacher Erasmus
Sarcerius wrote of the Mansfeld district in 1555, “seek to appropriate to
themselves the feudal rights and dues of the clergy and allow their
officials and justices to take forcible action.… The revenues of the Church
are spent in making roads and bridges and giving banquets, and are lent
from hand to hand without hypothecary security.”[176] The Calvinist,
Anton Prætorius, and many others not to mention Catholic
contemporaries, speak in similar terms.
Of the falling off in the Church funds and poor-boxes in the 16th
century in Hesse, in the Saxon Electorate, in Frankfurt-on-the-Main, in
Hamburg and elsewhere abundant proof is met with in the official records,
and this is the case even with regard to Würtemberg in the enactments of
the Dukes from 1552 to 1562, though that country constituted in some
respects an exception;[177] at a later date Duke Johann Frederick
hazarded the opinion that the regulations regarding the fund “had fallen
into oblivion.”
The growth of the proletariate, to remedy the impoverishment of which
no means had as yet been discovered, was in no small measure promoted
by Luther’s facilitation of marriage.
Luther himself had written, that “a boy ought to have recourse to
matrimony as soon as he is twenty and a maid when she is from fifteen to
eighteen years of age, and leave it to God to provide for their
maintenance and that of their children.”[178] Other adherents of the new
faith went even further, Eberlin of Günsburg simply declared: “As soon as
a girl is fifteen, a boy eighteen, they should be given to each other in
marriage.” There were others like the author of a “Predigt über Hunger-
und Sterbejahre, von einem Diener am Wort” (1571), who raised strong
objections against such a course. Dealing with the causes of the evident
increase of “deterioration and ruin” in “lands, towns and villages,” he says,
that “a by no means slight cause is the countless number of lightly
contracted marriages, when people come together and beget children
without knowing where they will get food for them, and so come down
themselves in body and soul, and bring up their children to begging from
their earliest years.” “And I cannot here approve of this sort of thing that
Luther has written: A lad should marry when he is twenty, etc. [see
above]. No, people should not think of marrying and the magistrates
should not allow them to do so before they are sure of being able at least
to provide their families with the necessaries of life, for else, as experience
shows, a miserable, degenerate race is produced.”[179]
What this old writer says is borne out by modern sociologists. One of
them, dealing with the 16th and 17th centuries, says: “These demands [of
Luther and Eberlin] are obviously not practicable from the economic point
of view, but from the ethical standpoint also they seem to us extremely
doubtful. To rush into marriage without prospect of sufficient maintenance
is not trusting God but tempting Him. Such marriages are extremely
immoral actions and they deserve legal punishment on account of their
danger to the community.” “Greater evil to the world can scarcely be
caused in any way than by such marriages. Even in the most favourable
cases such early marriages must have a deteriorating influence on the
physical and intellectual culture of posterity.”[180]
Owing to the neglect of any proper care for the poor the plague of
vagabondage continued on the increase. Luther’s zealous contemporary,
Cyriacus Spangenberg, sought to counteract it by reprinting the Master’s
edition of the “Liber vagatorum.” He says: “False begging and trickery has
so gained the upper hand that scarcely anybody is safe from imposture.”
The Superintendent, Nicholas Selnecker, again republished the writing
with Luther’s preface in 1580, together with some lamentations of his
own. He complains that “there are too many tramps and itinerant scholars
who give themselves up to nothing but knavery,” etc.[181]
Adolf Harnack is only re-echoing the complaints of 16th century
Protestants when he writes: “We may say briefly that, alas, nothing
of importance was achieved, nay, we must go further: the Catholics
are quite right when they assert that they, not we, lived to see a
revival of charitable work in the 16th century, and, that, where
Lutheranism was on the ascendant, social care of the poor was soon
reduced to a worse plight than ever before.”[182] The revival in
Catholic countries to which Harnack refers showed itself particularly
in the 17th century in the activity of the new Orders, whereas at this
time the retrograde movement was still in progress in the opposite
camp. “For a long time the Protestant relief system produced only
insignificant results.” It was not till the rise of Pietism and
Rationalism, i.e. until the inauguration of the admirable Home
Missions, that things began to improve. But Pietism and Rationalism
are both far removed from the original Lutheran orthodoxy.[183]

Some Recent Excuses


It has been remarked in excuse of Luther and his want of success,
that, “with merit and the hope of any reward, there also vanished
the stimulus to strive after the attainment of salvation by means of
works,” and that this being so, it was “not surprising” that charity—
the selfless fruit of faith—was wanting in many; “for new, albeit
higher moral motives, cannot at once come into play with the same
facility as the older ones which they displace; there comes a time
when the old motives have gone and when the new ones are
operative only in the case of a few; the leaven at first only works
gradually.” The history of the spread of “the higher motives of
morality” not only at the outset of Christianity but at all times,
shows, however, as a rule these to be most active under the
Inspiration of the Divine Spirit at the time when first accepted. Nor
does the comparison with the leaven in the passage quoted apply to
a state of decline and decay, where, for a change to be effected,
outside and entirely different elements were needed. We are told
that the new motives could not at once take effect, but, where the
delay extends over quite a century and a half, the blame surely
cannot be laid on the shortness of the time of probation.
Again, when we hear great stress laid on the fact that Luther at
least paved the way for State relief of the poor and, thus, far
outstrode the mediæval Church, one is justified in asking, whether in
reality State relief of the poor, with compulsory taxation, non-
intervention of Christian charity, or individual effort, or without any
morally elevating influence, is something altogether ideal; whether,
on the other hand, voluntary charity, as practised particularly by
associations, Orders or ecclesiastics, does not deserve a much higher
place and take precedence of, or at least stand side by side with, the
forced “charity” of the State. Even to-day Protestantism is seeking to
reserve a place for voluntary charitable effort. Considerations as to
the value of mere State charity would, however, carry us too far. We
must refer this matter to experts.[184]
That, before Luther’s day, the authorities took a reasonable and
even larger share in the relief of the poor than he himself
demanded, is evident from what has been said above (p. 43 ff.).
As a matter of fact, judging by what has gone before, the
assertion that the system of State relief of the poor was originated
by Luther or by Protestantism calls for considerable “revision.” “The
reformation,” so the sociological authority we have so frequently
quoted says, “created neither the communal nor the governmental
system of poor relief.”[185] This he finds borne out by the different
schemes for the relief of the poor contained in the old ecclesiastical
constitutions. It is true, he says, that, “according to the idea in
vogue, the origin of our present Poor Law can be traced back
directly” to the Reformation. Nevertheless, the changes that took
place in the social care of the poor subsequent to Luther’s day,
though certainly “far-reaching enough,” were “exclusively negative”;
[186] owing to his exertions the Church property and that set aside
for the relief of the poor was secularised, and the previous free-
handed method of distribution ceased; all further growth of
legislation on the subject in the prosperous and independent
townships was effectually hindered; out of the mass of property that
passed into alien hands only a few scraps could be spared by the
secular rulers and handed over to the ministers for the benefit of the
poor.
This was no State-regulation of poor relief as we now understand
it. Still, the way was paved for it in so far as the props of the olden
ecclesiastical system of relief had been felled and had eventually to
be replaced by something new. In this sense it may be said that
Luther’s work “paved the way” for the new conditions.[187]

5. Luther’s Attitude towards Worldly Callings


An attempt has been made to prove the truth of the dictum so
often met with on the lips of Protestants, viz. that “Luther was the
creator of those views of the world and life on which both the State
and our modern civilisation rest,” by arguing, that, at least, he made
an end of contempt for worldly callings and exalted the humbler as
well as the higher spheres of life at the expense of the ecclesiastical
and monastic. What Luther himself frequently states concerning his
discovery of the dignity of the secular callings has elsewhere been
placed in its true light (and the unhistoric accounts of his admirers
are all in last resort based on his). This was done in the most
suitable place, viz. when dealing with “Luther and Lying,” and with
his spiteful caricature of the mediæval Church.[188] Still, for the sake
of completeness, the claims Luther makes in this respect, and some
new proofs in refutation of them, must be briefly called to mind in
the present chapter. It is not unusual for his admirers to speak with
a species of awe of Luther’s achievements in this respect:
“One of the most Momentous Achievements of the Reformation”
The claims Luther makes in respect of his labours on behalf of the
worldly callings are even greater than his admirers would lead one to
suppose. His actual words reveal their hyperbolical character, or
rather untruth, by their very extravagance.
Luther we have heard say: “Such honour and glory have I by the
grace of God, that, since the time of the Apostles no doctor … has
confirmed and instructed the consciences of the secular estates so
well and lucidly as I.”[189]—It was quite different with the “monks
and priestlings”! They “damned both the laity and their calling.”
These “revolutionary blasphemers” condemned “all the states of life
that God instituted and ordained”; on the other hand, they extol
their self-chosen and accursed state as though outside of it no one
could be saved.[190]
The phantom of a Popish, monkish holiness-by-works never left
him. In his Commentary on Genesis, though he holds that he has
already taught the Papists more than they deserve on the right
appreciation of the lower callings and labours, yet he once more
informs them of his discovery, “that the work of the household and
of the burgher,” such as hospitality, the training of children, the
supervision of servants, “despised though they be as common and
worthless,” are also well-pleasing to God. “Such things must be
judged according to the Word [of God], not according to reason!…
Let us therefore thank God that we, enlightened by the Word, now
perceive what are really good works, viz. obedience to those in
authority, respect for parents, supervision of the servants and
assistance of our brethren.” “These are callings instituted by God.”
“When the mother of a family provides diligently for her family, looks
after the children, feeds them, washes them and rocks them in the
cradle,” this calling, followed for God’s sake, is “a happy and a holy
one.”[191]
Luther is never tired of claiming as his peculiar teaching that even
the most humble calling—that of the maid or day-labourer—may
prove a high and exalted road to heaven and that every kind of
work, however insignificant, performed in that position of life to
which a man is called is of great value in God’s sight when done in
faith. He is fond of repeating, that a humble ploughman can lay up
for himself as great a treasure in heaven by tilling his field, as the
preacher or the schoolmaster, by their seemingly more exalted
labours.
There is no doubt, that, by means of this doctrine, which
undoubtedly is not without foundation, he consoled many of the
lower classes, and brought them to a sense of their dignity as
Christians. It is true that it was his polemics against monasticism and
the following of the counsels of perfection which led him to make so
much of the ordinary states of life and to paint them in such glowing
colours. Nevertheless, we must admit that he does so with real
eloquence and by means of comparisons and figures taken from
daily life which could not but lend attraction to the truth and which
differ widely from the dry, scholastic tone of some of his Catholic
predecessors in this field.
He does not, however, really add a single fresh element to the
olden teaching, or one that cannot be traced back to earlier times.
Either Luther was not aware of this, or else he conceals it from his
hearers and readers. It would have been possible to confront him
with a whole string of writers, ancient and mediæval, and even from
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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like