100% found this document useful (1 vote)
39 views

Buy Ebook Data Analysis With Python and PySpark (MEAP V07) Jonathan Rioux Cheap Price

Rioux

Uploaded by

wamgghoost
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
39 views

Buy Ebook Data Analysis With Python and PySpark (MEAP V07) Jonathan Rioux Cheap Price

Rioux

Uploaded by

wamgghoost
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Data Analysis with Python and PySpark (MEAP


V07) Jonathan Rioux

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

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Data Analysis from Scratch with Python Peters Morgan

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

textbookfull.com

A Python Data Analyst’s Toolkit: Learn Python and Python-


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

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/

textbookfull.com

Go Optimizations 101 Tapir Liu

https://textbookfull.com/product/go-optimizations-101-tapir-liu/

textbookfull.com
Black Children in Hollywood Cinema: Cast in Shadow 1st
Edition Debbie Olson (Auth.)

https://textbookfull.com/product/black-children-in-hollywood-cinema-
cast-in-shadow-1st-edition-debbie-olson-auth/

textbookfull.com

University, court, and slave : proslavery academic thought


and southern jurisprudence, 1831-1861 1st Edition Brophy

https://textbookfull.com/product/university-court-and-slave-
proslavery-academic-thought-and-southern-jurisprudence-1831-1861-1st-
edition-brophy/
textbookfull.com

Security in the Persian Gulf Region 1st Edition Fatemeh


Shayan (Auth.)

https://textbookfull.com/product/security-in-the-persian-gulf-
region-1st-edition-fatemeh-shayan-auth/

textbookfull.com

The geometry of musical rhythm : what makes a "good"


rhythm good? Second Edition Godfried T. Toussaint

https://textbookfull.com/product/the-geometry-of-musical-rhythm-what-
makes-a-good-rhythm-good-second-edition-godfried-t-toussaint/

textbookfull.com

The Muscular System Manual The Skeletal Muscles of the


Human Body Joseph E. Muscolino

https://textbookfull.com/product/the-muscular-system-manual-the-
skeletal-muscles-of-the-human-body-joseph-e-muscolino/

textbookfull.com
A System of Health Accounts 2011 Organization For Economic
Cooperation And Development

https://textbookfull.com/product/a-system-of-health-
accounts-2011-organization-for-economic-cooperation-and-development/

textbookfull.com
MEAP Edition
Manning Early Access Program
Data Analysis with Python and PySpark
Version 77

Copyright 2020 Manning Publications

For more information on this and other Manning titles go to


manning.com

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
welcome
Thank you for purchasing the MEAP for Data Analysis with Python and PySpark. It is a
lot of fun (and work!) and I hope you’ll enjoy reading it as much as I am enjoying
writing the book.
My journey with PySpark is pretty typical: the company I used to work for migrated their
data infrastructure to a data lake and realized along the way that their usual warehouse-type
jobs didn’t work so well anymore. I spent most of my first months there figuring out how to
make PySpark work for my colleagues and myself, starting from zero. This book is very
influenced by the questions I got from my colleagues and students (and sometimes myself).
I’ve found that combining practical experience through real examples with a little bit of
theory brings not only proficiency in using PySpark, but also how to build better data
programs. This book walks the line between the two by explaining important theoretical
concepts without being too laborious.
This book covers a wide range of subjects, since PySpark is itself a very versatile
platform. I divided the book into three parts.
• Part 1: Walk teaches how PySpark works and how to get started and perform basic
data manipulation.
• Part 2: Jog builds on the material contained in Part 1 and goes through more advanced
subjects. It covers more exotic operations and data formats and explains more what
goes on under the hood.
• Part 3: Run tackles the cooler stuff: building machine learning models at scale,
squeezing more performance out of your cluster, and adding functionality to PySpark.
To have the best time possible with the book, you should be at least comfortable using
Python. It isn’t enough to have learned another language and transfer your knowledge into
Python. I cover more niche corners of the language when appropriate, but you’ll need to
do some research on your own if you are new to Python.
Furthermore, this book covers how PySpark can interact with other data manipulation
frameworks (such as Pandas), and those specific sections assume basic knowledge of
Pandas.
Finally, for some subjects in Part 3, such as machine learning, having prior exposure will
help you breeze through. It’s hard to strike a balance between “not enough explanation” and
“too much explanation”; I do my best to make the right choices.
Your feedback is key in making this book its best version possible. I welcome your
comments and thoughts in the liveBook discussion forum.
Thank you again for your interest and in purchasing the MEAP!

—Jonathan Rioux

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
brief contents
PART 1: WALK
1 Introduction
2 Your first data program in PySpark
3 Submitting and scaling your first PySpark program
4 Analyzing tabular data with pyspark.sql
5 The data frame through a new lens: joining and grouping
PART 2: JOG
6 Multi-dimentional data frames: using PySpark with JSON data
7 Bilingual PySpark: blending Python and SQL code
8 Extending PySpark with user-defined-functions
9 Faster PySpark: understanding Spark’s query planning
PART 3: RUN
10 A foray into machine learning: logistic regression with PySpark
11 Robust machine learning with ML Pipelines
12 PySpark and unstructured data
13 PySpark for graphs: GraphFrames
14 Testing PySpark code
15 Even faster PySpark: identify and solve bottlenecks
16 Going full circle: structuring end-to-end PySpark code
APPENDIXES:
A Exercise solutions
B Installing PySpark locally
C Using PySpark with a cloud provider
D Python essentials
E PySpark data types
F Efficiently using PySpark’s API documentation

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
1

In this chapter, you will learn


Introduction
1
What is PySpark
Why PySpark is a useful tool for analytics
The versatility of the Spark platform and its limitations
PySpark’s way of processing data

According to pretty much every news outlet, data is everything, everywhere. It’s the new oil, the
new electricity, the new gold, plutonium, even bacon! We call it powerful, intangible, precious,
dangerous. I prefer calling it useful in capable hands. After all, for a computer, any piece of data
is a collection of zeroes and ones, and it is our responsibility, as users, to make sense of how it
translates to something useful.

Just like oil, electricity, gold, plutonium and bacon (especially bacon!), our appetite for data is
growing. So much, in fact, that computers aren’t following. Data is growing in size and
complexity, yet consumer hardware has been stalling a little. RAM is hovering for most laptops
at around 8 to 16 GB, and SSD are getting prohibitively expensive past a few terabytes. Is the
solution for the burgeoning data analyst to triple-mortgage his life to afford top of the line
hardware to tackle Big Data problems?

Introducing Spark, and its companion PySpark, the unsung heroes of large-scale analytical
workloads. They take a few pages of the supercomputer playbook— powerful, but manageable,
compute units meshed in a network of machines— and bring it to the masses. Add on top a
powerful set of data structures ready for any work you’re willing to throw at them, and you have
a tool that will grow (pun intended) with you.

This book is great introduction to data manipulation and analysis using PySpark. It tries to cover

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
2

just enough theory to get you comfortable, while giving enough opportunities to practice. Each
chapter except this one contains a few exercices to anchor what you just learned. The exercises
are all solved and explained in Appendix A.

1.1 What is PySpark?


What’s in a name? Actually, quite a lot. Just by separating PySpark in two, one can already
deduce that this will be related to Spark and Python. And it would be right!

At the core, PySpark can be summarized as being the Python API to Spark. While this is an
accurate definition, it doesn’t give much unless you know the meaning of Python and Spark. If
we were in a video game, I certainly wouldn’t win any prize for being the most useful NPC.
Let’s continue our quest to understand what is PySpark by first answering What is Spark?.

1.1.1 You saw it coming: What is Spark?


Spark, according to their authors, is a unified analytics engine for large-scale data processing.
This is a very accurate definition, if a little dry.

Digging a little deeper, we can compare Spark to an analytics factory. The raw material— here,
data— comes in, and data, insights, visualizations, models, you name it! comes out.

Just like a factory will often gain more capacity by increasing its footprint, Spark can process an
increasingly vast amount of data by scaling out instead of scaling up. This means that, instead of
buying thousand of dollars of RAM to accommodate your data set, you’ll rely instead of multiple
computers, splitting the job between them. In a world where two modest computers are less
costly than one large one, it means that scaling out is less expensive than up, keeping more
money in your pockets.

The problem with computers is that they crash or behave unpredictably once in a while. If
instead of one, you have a hundred, the chance that at least one of them go down is now much
higher.1 Spark goes therefore through a lot of hoops to manage, scale, and babysit those poor
little sometimes unstable computers so you can focus on what you want, which is to work with
data.

This is, in fact, one of the weird thing about Spark: it’s a good tool because of what you can do
with it, but especially because of what you don’t have to do with it. Spark provides a powerful
API2 that makes it look like you’re working with a cohesive, non-distributed source of data,
while working hard in the background to optimize your program to use all the power available.
You therefore don’t have to be an expert at the arcane art of distributed computing: you just need
to be familiar with the language you’ll use to build your program. This leads us to…​

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
3

1.1.2 PySpark = Spark + Python


PySpark provides an entry point to Python in the computational model of Spark. Spark itself is
coded in Scala, a language very powerful if a little hard to grasp. In order to meet users where
they are, Spark also provides an API in Java, Python and R. The authors did a great job at
providing a coherent interface between language while preserving the idiosyncrasies of the
language where appropriate. Your PySpark program will therefore by quite easy to read by a
Scala/Spark programmer, but also to a fellow Python programmer who hasn’t jumped into the
deep end (yet).

Python is a dynamic, general purpose language, available on many platforms and for a variety of
tasks. Its versatility and expressiveness makes it an especially good fit for PySpark. The
language is one of the most popular for a variety of domains, and currently is a major force in
data analysis and science. The syntax is easy to learn and read, and the amount of library
available means that you’ll often find one (or more!) who’s just the right fit for your problem.

1.1.3 Why PySpark?


There are no shortage of libraries and framework to work with data. Why should one spend their
time learning PySpark specifically?

PySpark packs a lot of advantages for modern data workloads. It sits at the intersection of fast,
expressive and versatile. Let’s explore those three themes one by one.

PYSPARK IS FAST
If you search "Big Data" in a search engine, there is a very good chance that Hadoop will come
within the first few results. There is a very good reason to this: Hadoop popularized the famous
MapReduce framework that Google pioneered in 2004 and is now a staple in Data Lakes and Big
Data Warehouses everywhere.

Spark was created a few years later, sitting on Hadoop’s incredible legacy. With an aggressive
query optimizer, a judicious usage of RAM and some other improvements we’ll touch on in the
next chapters, Spark can run up to 100x faster than plain Hadoop. Because of the integration
between the two frameworks, you can easily switch your Hadoop workflow to Spark and gain
the performance boost without changing your hardware.

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
4

PYSPARK IS EXPRESSIVE
Beyond the choice of the Python language, one of the most popular and easy-to-learn language,
PySpark’s API has been designed from the ground up to be easy to understand. Most programs
read as a descriptive list of the transformations you need to apply to the data, which makes them
easy to reason about. For those familiar with functional programming languages, PySpark code
is conceptually closer to the "pipe" abstraction rather than pandas, the most popular in-memory
DataFrame library.

You will obviously see many examples through this book. As I was writing those examples, I
was pleased about how close to my initial (pen and paper) reasoning the code ended up looking.
After understanding the fundamentals of the framework, I’m confident you’ll be in the same
situation.

PYSPARK IS VERSATILE
There are two components to this versatility. First, there is the availability of the framework.
Second, there is the diversified ecosystem surrounding Spark.

PySpark is everywhere. All three major cloud providers have a managed Hadoop/Spark cluster
as part of their offering, which means you have a fully provisioned cluster at a click of a few
buttons. You can also easily install Spark on your own computer to nail down your program
before scaling on a more powerful cluster. Appendix B covers how to get your own local Spark
running, while Appendix C will walk through the current main cloud offerings.

PySpark is open-source. Unlike some other analytical software, you aren’t tied to a single
company. You can inspect the source code if you’re curious, and even contribute if you have an
idea for a new functionality or find a bug. It also gives a low barrier to adoption: download,
learn, profit!

Finally, Spark’s eco-system doesn’t stop at PySpark. There is also an API for Scala, Java, R, as
well as a state-of-the-art SQL layer. This makes it easy to write a polyglot program in Spark. A
Java software engineer can tackle the ETL pipeline in Spark using Java, while a data scientist can
build a model using PySpark.

WHERE PYSPARK FELL SHORT


It would be awesome if PySpark was The Answer to every data problem. Unfortunately, there
are some caveats. None of them are a deal-breakers, but they are to be considered when you’re
selecting a framework for your next project.

PySpark isn’t the right choice if you’re dealing with small data sets. Managing a distributed
cluster comes with some overhead, and if you’re just using a single node, you’re paying the price
but aren’t using the benefits. As an example, a PySpark shell will take a few seconds to launch:

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
5

this is often more than enough time to process data that fits within your RAM.

PySpark also has a disadvantage when it comes to the Java and Scala API. Since Spark is at the
core a Scala program, Python code have to be translated to and from JVM3 instructions. While
more recent versions have been bridging that gap pretty well, pure Python translation, which
happens mainly when you’re defining your own User Defined Functions (UDF), will perform
slower. We will cover UDF and some ways to mitigate the performance problem in Chapter 8.

Finally, while programming PySpark can feel easy and straightforward, managing a cluster can
be a little arcane. Spark is a pretty complicated piece of software, and while the code base
matured remarkably over the past few years, the days where scaling a 100-machine cluster and
manage it as easily as a single node are far ahead. We will cover some of the developer-facing
configuration and problems in the Chapter about performance, but for hairier problems, do what
I do: befriend your dev ops.

1.1.4 Your very own factory: how PySpark works


In this section, I will explain how Spark processes a program. It can be a little odd to present the
workings and underpinnings of a system that we claimed, a few paragraphs ago, hides that
complexity. We still think that having a working knowledge of how Spark is set up, how it
manages data and how it optimizes queries is very important. With this, you will be able to
reason with the system, improve your code and figure out quicker when it doesn’t perform the
way you want.

If we’re keeping the factory analogy, we can imagine that the cluster of computer where Spark is
sitting on is the building.

Figure 1.1 A totally relatable data factory, outside and in.

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
6

If we look at , we can see two different way to interpret a data factory. On the left, we see how it
looks like from the outside: a cohesive unit where projects come in and results comes out. This is
what it will appear to you most of the time. Under the hood, it looks more like on the right: you
have some workbenches where some workers are assigned to. The workbenches are like the
computers in our Spark cluster: there is a fixed amount of them, and adding or removing some is
easy but needs to be planned in advance. The workers are called executors in Spark’s literature:
they are the one performing the actual work on the machines.

One of the little workers looks spiffier than the other. That top hat definitely makes him stand out
of the crowd. In our data factory, he’s the manager of the work floor. In Spark terms, we call this
the master. In the spirit of the open work-space, he shares one of the workbenches with his
fellow employees. The role of the master is crucial to the efficient execution of your program, so
is dedicated to this.

1.1.5 Some physical planning with the cluster manager


Upon reception of the task, which is called a driver program in the Spark world, the factory
starts running. This doesn’t mean that we get straight to processing! Before that, the cluster need
to plan the capacity it will allocate for your program. The entity, or program, taking care of this
is aptly called the cluster manager. In our factory, this cluster manager will look at the
workbenches with available space and secure as many as necessary, then start hiring workers to
fill the capacity. In Spark, it will look at the machines with available computing resources and
secure what’s necessary, before launching the required number of executors across them.

NOTE Spark provides its own cluster manager, but can also play well with other
ones when working in conjunction with Hadoop or another Big Data
platform. We will definitely discuss the intricacies of managing the cluster
manager (pun intended) in the chapter about performance, but in the
meantime, if you read about YARN or Mesos in the wild, know that they are
two of the most popular nowadays.

Any directions about capacity (machines and executors) are encoded in a SparkContext object
which represents the connection to our Spark cluster. Since our instructions didn’t mention any
specific capacity, the cluster manager will allocate the default capacity prescribed by our Spark
installation.

We’re off to a great start! We have a task to accomplish, and the capacity to accomplish it.
What’s next? Let’s get working!

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
7

1.1.6 A factory made efficient through a lazy manager


Just like in a large-scale factory, you don’t go to each employee and give them a list of tasks. No,
here, you’ll provide your list of steps to the manager and let them deal with it. In Spark, the
manager/master takes your instructions (carefully written in Python code), translate them in
Spark steps and then process them across the worker. The master will also manage which worker
(more on them in a bits) has which slice of the data, and make sure that you don’t lose some bits
in the process.

Your manager/master has all the qualities a good manager has: smart, cautious and lazy. Wait,
what? You read me right. Laziness in a programming context— and one could argue in the real
world too— can actually be very good thing. Every instruction you’re providing in Spark can be
classified in two categories: transformations and actions. Actions are what many programming
languages would consider IO. Actions includes, but are not limited to:

Printing information on the screen


Writing data to a hard drive or cloud bucket

In Spark, we’ll see those instructions most often via the show and write methods, as well as
other calling those two in their body.

Transformations are pretty much everything else. Some examples of transformation are:

Adding a column to a table


Performing an aggregation according to certain keys
Computing summary statistics on a data set
Training a Machine Learning model on some data

Why the distinction, you might ask? When thinking about computation over data, you, as the
developer, are only concerned about the computation leading to an action. You’ll always interact
with the results of an action, because this is something you can see. Spark, with his lazy
computation model, will take this to the extreme and will avoid performing data work until an
action triggers the computation chain. Before that, the master will store (or cache) your
instructions. This way of dealing with computation has many benefits when dealing with large
scale data.

First, storing instructions in memory takes much less space than storing intermediate data results.
If you are performing many operations on a data set and are materializing the data each step of
the way, you’ll blow your storage much faster although you don’t need the intermediate results.
We can all argue that less waste is better.

Second, by having the full list of tasks to be performed available, the master can optimize the
work between executors much more efficiently. It can use information available at run-time, such
as the node where specific parts of the data are located. It can also re-order and eliminate useless

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
8

transformations if necessary.

Finally, during interactive development, you don’t have to submit a huge block of commands
and wait for the computation to happen. Instead, you can iteratively build your chain of
transformation, one at the time, and when you’re ready to launch the computation (like during
your coffee break), you can add an action and let Spark work its magic.

Lazy computation is a fundamental aspect of Spark’s operating model and part of the reason it’s
so fast. Most programming languages, including Python, R and Java, are eagerly evaluated. This
means that they process instructions as soon as they receive them. If you have never worked with
a lazy language before, it can look a little foreign and intimidating. If this is the case, don’t
worry: we’ll weave practical explanations and implications of that laziness during the code
examples when relevant. You’ll be a lazy pro in no time!

NOTE Reading data, although clearly being I/O, is considered a transformation by


Spark. This is due to the fact that reading data doesn’t perform any visible
work to the user. You therefore won’t read data until you need to display or
write it somewhere.

What’s a manager without competent employees? Once the task, with its action, has been
received, the master starts allocating data to what Spark calls executors. Executors are processes
that run computations and store data for the application. Those executors sit on what’s called a
worker node, which is the actual computer. In our factory analogy, an executor would be an
employee performing the work, while the worker node would be a workbench where many
employees/executors can work. If we recall , our master wears a top hat and sits with his
employees/workers at one of the workbenches.

That concludes our factory tour. Let’s summarize our typical PySpark program.

We first encode our instructions in Python code, forming a driver program.

When submitting our program (or launching a PySpark shell), the cluster manager allocates
resources for us to use. Those will stay constant for the duration of the program.

The master ingests your code and translate it into Spark instructions. Those instructions are
either transformations or actions.

Once the master reaches an action, it optimizes the whole computation chain and splits the work
between executors. Executors are processes performing the actual data work and they reside on
machines labelled worked nodes.

That’s it! As we can see, the overall process is quite simple, but it’s obvious that Spark hides a
lot of the complexity arising from efficient distributed processing. For a developer, this means

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
9

shorter and clearer code, and a faster development cycle.

1.2 What will you learn in this book?


This book will use PySpark to solve a variety of tasks a data analyst, engineer or scientist will
encounter during his day to day life. We will therefore

read and write data from (and to) a variety of sources and formats;
deal with messy data with PySpark’s data manipulation functionality;
discover new data sets and perform exploratory data analysis;
build data pipelines that transform, summarize and get insights from data in an automated
fashion;
test, profile and improve your code;
troubleshoot common PySpark errors, how to recover from them and avoid them in the
first place.

After covering those fundamentals, we’ll also tackle different tasks that aren’t as frequent, but
are interesting and an excellent way to showcase the power and versatility of PySpark.

We’ll perform Network Analysis using PySpark’s own graph representation


We’ll build Machine Learning models, from simple throwaway experiments to Deep
Learning goodness
We’ll extend PySpark’s functionality using user defined functions, and learn how to work
with other languages

We are trying to cater to many potential readers, but are focusing on people with little to no
exposure to Spark and/or PySpark. More seasoned practitioners might find useful analogies for
when they need to explain difficult concepts and maybe learn a thing or two!

The book focuses on Spark version 2.4, which is currently the most recent available. Users on
older Spark versions will be able to go through most of the code in the book, but we definitely
recommend using at least Spark 2.0+.

We’re assuming some basic Python knowledge: some useful concepts are outlined in Appendix
D. If you feel for a more in-depth introduction to Python, I recommend The Quick Python Book,
by Naomi Ceder (Manning, 2018).

1.3 What do I need to get started?


In order to get started, the only thing absolutely necessary is a working installation of Spark. It
can be either on your computer (Appendix B) or using a cloud provider (Appendix C). Most
examples in the book are doable using a local installation of Spark, but some will require more
horsepower and will be identified as such.

A code editor will also be very useful for writing, reading and editing scripts as you go through

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
10

the examples and craft your own programs. A Python-aware editor, such as PyCharm, is a
nice-to-have but is in no way necessary. Just make sure it saves your code without any
formatting: don’t use Microsoft Word to write your programs!

The book’s code examples are available on GitHub, so Git will be a useful piece of software to
have. If you don’t know git, or don’t have it handy, GitHub provides a way to download all the
book’s code in a Zip file. Make sure you check regularly for updates!

Finally, I recommend that you have an analog way of drafting your code and schema. I am a
compulsive note-taker and doodler, and even if my drawing are very basic and crude, I find that
working through a new piece of software via drawings helps in clarifying my thoughts. This
means less code re-writing, and a happier programmer! Nothing spiffy, some scrap paper and a
pencil will do wonders.

1.4 Summary
PySpark is the Python API for Spark, a distributed framework for large-scale data
analysis. It provides the expressiveness and dynamism of the Python programming
language to Spark.
PySpark provides a full-stack analytics workbench. It has an API for data manipulation,
graph analysis, streaming data as well as machine learning.
Spark is fast: it owes its speed to a judicious usage of the RAM available and an
aggressive and lazy query optimizer.
Spark provides bindings for Python, Scala, Java, and R. You can also use SQL for data
manipulation.
Spark uses a master which processes the instructions and orchestrates the work. The
executors receive the instructions from the master and perform the work.
All instructions in PySpark are either transformations or actions. Spark being lazy, only
actions will trigger the computation of a chain of instructions.

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
11

Your first data program in PySpark

This chapter covers:


2
Launching and using the pyspark shell for interactive development
Reading and ingesting data into a data frame
Exploring data using the DataFrame structure
Selecting columns using the select() method
Filtering columns using the where() method
Applying simple functions to your columns to modify the data they contain
Reshaping singly-nested data into distinct records using explode()

Data-driven applications, no matter how complex, all boils down to what I like to call three
meta-steps, which are easy to distinguish in a program.

1. We start by ingesting or reading the data we wish to work with.


2. We transform the data, either via a few simple instructions or a very complex machine
learning model
3. We then export the resulting data, either into a file to be fed into an app or by
summarizing our findings into a visualization.

The next two chapters will introduce a basic workflow with PySpark via the creation of a simple
ETL (Extract, Transform and Load, which is a more business-speak way of saying Ingest,
Transform and Export). We will spend most of our time at the pyspark shell, interactively
building our program one step at a time. Just like normal Python development, using the shell or
REPL (I’ll use the terms interchangeably) provides rapid feedback and quick progression. Once
we are comfortable with the results, we will wrap our program so we can submit it in batch
mode.

Data manipulation is the most basic and important aspect of any data-driven program and
PySpark puts a lot of focus on this. It serves as the foundation of any reporting, any machine

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
12

learning or data science exercise we wish to perform. This section will give you the tools to not
only use PySpark to manipulate data at scale, but also how to think in terms of data
transformation. We obviously can’t cover every function provided in PySpark, but I’ll provide a
good explanation of the ones we use. I’ll also introduce how to use the shell as a friendly
reminder for those cases when you forget how something works.

Since this is your first end-to-end program in PySpark, we’ll get our feet wet with a simple
problem to solve: counting the most popular word being used in the English language. Now,
since collecting all the material ever produced in the English language would be a massive
undertaking, we’ll start with a very small sample: Pride and Prejudice by Jane Austen. We’ll
make our program work with this small sample and then scale it to ingest a larger corpus of text.

Since this is our first program, and I need to introduce many new concepts, this Chapter will
focus on the data manipulation part of the program. Chapter 3 will cover the final computation as
well as wrapping our program and then scaling it.

TIP The book repository, containing the code and data used for the examples
and exercises, is available at https://github.com/jonesberg/PySparkInAction
.

2.1 Setting up the pyspark shell


PySpark provides a REPL (Read, eval, print loop) for interactive development. Python and other
programming language families, such as Lisp, also provides one, so there is a good chance that
you already worked with one in the past. It speeds up your development process by giving
instantaneous feedback the moment you submit an instruction, instead of forcing you to compile
your program and submit it as one big monolithic block. I’ll even say that using a REPL is even
more useful in PySpark, since every operation can take a fair amount of time. Having a program
crash mid-way is always frustrating, but it’s even worse when you’ve been running a data
intensive job for a few hours.

For this chapter (and the rest of the book), I assume that you have access to a working
installation of Spark, either locally or in the cloud. If you want to perform the installation
yourself, Appendix B contains step-by-step instructions for Linux, OsX and Windows. If you
can’t install it on your computer, or prefer not to, Appendix C provides a few cloud-powered
options as well as additional instructions to upload your data and make it visible to Spark.

Once everything is set up, you can launch the pyspark shell by inputting pyspark into your
terminal. You should see an ASCII-art version of the Spark logo, as well as some useful
information. shows what happens on my local machine.

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
13

Listing 2.1 Launching pyspark on a local machine


$ pyspark

Python 3.7.3 (default, Mar 27 2019, 16:54:48)


Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
19/09/07 12:16:47 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin

Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties


Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/__ / .__/\_,_/_/ /_/\_\ version 2.4.3
/_/

Using Python version 3.7.3 (default, Mar 27 2019 16:54:48)


SparkSession available as 'spark'.

In [1]:

When using PySpark locally, you most often won’t have a full Hadoop cluster
pre-configured. For learning purposes, this is perfectly fine.
Spark is indicating the level of details it’ll provide to you. We will see how to
configure this in .
We are using Spark version 2.4.3
PySpark is using the Python available on your path.
The pyspark shell provides an entry point for you through the variable spark.
More on this in .
The REPL is now ready for your input!

NOTE I highly recommend you using IPython when using PySpark in interactive
mode. IPython is a better front-end to the Python shell containing many
useful functionalities, such as friendlier copy-and-paste and syntax
highlighting. The installation instructions in Appendix B includes configuring
PySpark to use the IPython shell.

While all the information provided in is useful, two elements are worth expanding on: the
SparkSession entry point and the log level.

2.1.1 The SparkSession entry-point


In we saw that, upon launching the PySpark shell creates a spark variable that refers to
SparkSession entry point. I will discuss about this entry point in this section as it provides the
functionality for us to read data into PySpark4.

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
14

In Chapter 1, we spoke briefly about the Spark entry point called SparkContext. SparkSession
is a super-set of that. It wraps the SparkContext and provides functionality for interacting with
data in a distributed fashion.Just to prove our point, see how easy it is to get to the
SparkContext from our SparkSession object: just call the sparkContext attribute from
spark.

$ spark.sparkContext
# <SparkContext master=local[*] appName=PySparkShell>

The SparkSession object is a recent addition to the PySpark API, making its way in version
2.0. This is due to the API evolving in a way that makes more room for the faster, more versatile
data frame as the main data structure over the lower level RDD. Before that time, you had to use
another object (called the SQLContext) in order to use the data frame. It’s much easier to have
everything under a single umbrella.

This book will focus mostly on the data frame as our main data structure. I’ll discuss about the
RDD in Chapter 8, when we discuss about lower-level PySpark programming and how to embed
our own Python functions in our programs.

SIDEBAR Reading older PySpark code


While this book shows modern PySpark programming, we are not living in
a vacuum. If you go on the web, you might face older PySpark code that
uses the former SparkContext/ sqlContext combo. You’ll also see the sc
variable mapped to the SparkContext entry-point. With that we know about
SparkSession and SparkContext, we can reason about old PySpark code
by using the following variable assignments.

sc = spark.sparkContext
sqlContext = spark

You’ll see traces of SQLContext in the API documentation for backwards


compatibility. I recommend avoiding using this as the new SparkSession
approach is cleaner, simpler and more future-proof.

2.1.2 Configuring how chatty spark is: the log level


Monitoring your PySpark jobs is an important part of developing a robust program. PySpark
provides many levels of logging, from nothing at all to a full description of everything happening
on the cluster. By default, the pyspark shell defaults on WARN, that can be a little chatty when
we’re learning. Fortunately, we can change the settings for your session by using the code in .

Listing 2.2 Deciding on how chatty you want PySpark to be.


spark.sparkContext.setLogLevel(KEYWORD)

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
15

lists the available keywords you can pass to setLogLevel. Each subsequent keyword contains
all the previous ones, with the obvious exception of OFF that doesn’t show anything.

Table 2.1mlog level keywords


Keyword Signification
OFF No logging at all (not recommended).
FATAL Only fatal errors
ERROR My personal favorite, will show FATAL as well as other
useful (but recoverable) errors.
WARN Add warnings (and there is quite a lot of them).
INFO Will give you runtime information
DEBUG Will provide debug information on your jobs.
TRACE Will trace your jobs (more verbose debug logs). Can be
quite pedagogic, but very annoying.
ALL Everything that PySpark can spit, it will spit.

NOTE When using the pyspark shell, anything chattier than WARN might appear
when you’re typing a command, which makes it quite hard to input
commands into the shell. You’re welcome to play with the log levels as you
please, but we won’t show any output unless it’s valuable for the task at
hand.
Setting the log level to ALL is a very good way to annoy oblivious
co-workers if they don’t lock their computers. You haven’t heard it from me.

You now have the REPL fired-up and ready for your input.

2.2 Mapping our program


In the Chapter introduction, we introduced our problem statement: what are the most popular
words in the English language? Before even hammering code in the REPL, we can start by
mapping the major steps our program will need to perform.

1. Read: Read the input data (we’re assuming a plain text file)
2. Token: Tokenize each word
3. Clean: Remove any punctuation and/or tokens that aren’t words.
4. Count: Count the frequency of each word present in the text
5. Answer: Return the top 10 (or 20, 50, 100)

Visually, a simplified flow of our program would look like

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
16

Figure 2.1 A simplified flow of our program, illustrating the 5 steps.

Our goal is quite lofty: the English language produced through history an unfathomable amount
of written material. Since we are learning, we’ll start with a relatively small source, get our
program working, and then scale it to accommodate a larger body of text. For this, I chose to use
Jane Austen’s Pride and Prejudice, since it’s already in plain text and freely available.

SIDEBAR Data analysis and Pareto’s principle


Pareto’s principle, also known commonly as the 80/20 rules, is often
summarized as 20% of the efforts will yield 80% of the results. In data
analysis, we can consider that 20% to be analysis, visualization, machine
learning models, anything that provides tangible value to the recipient.
The remainder is what I call invisible work: ingesting the data, cleaning
it, figuring its meaning and shaping it into a usable form. If you look at your
simple steps, Step 1 to 3 can be considered invisible work: we’re ingesting
data and getting it ready for the counting process. Step 4 and 5 are really
the visible ones that are answering our question (one could argue that only
Step 5 is performing visible work, but let’s not split hairs here). Steps 1 to 3
are there because the data requires processing to be usable for our
problem. They aren’t core to our problem, but we can’t do without them.
When building your own project, this will be the part that will be the
most time consuming and you might be tempted (or pressured!) to skimp
on it. Always keep in mind that the data you ingest and process is the raw
material of your programs, and that feeding it garbage will yield, well,
garbage.

2.3 Reading and ingesting data into a data frame


The first step of our program is to ingest the data in a structure we can perform work in. PySpark
provides two main structures for performing data manipulation:

1. The Resilient Distributed Dataset (or RDD)


2.
©Manning Publications Co. To comment go to liveBook
https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
17

2. The data frame

The RDD can be seen like a distributed collection of objects. I personally visualize this as a bag
that you give orders to. You pass orders to the RDD through regular Python functions over the
items in the bag.

The data frame is a stricter version of the RDD: conceptually, you can think of it like a table,
where each cell can contain one value. The data frame makes heavy usage of the concept of
columns where you perform operation on columns instead of on records, like in the RDD.
provides a visual summary of the two structures.

If you’ve used SQL in the past, you’ll find that the data frame implementation takes a lot of
inspiration from SQL. The module name for data organization and manipulation is even named
pyspark.sql! Furthermore, Chapter 7 will teach you how to mix PySpark and SQL code within
the same program.

Figure 2.2 A RDD vs a data frame. In the RDD, each record is processed independently.
With the data frame, we work with its columns, performing functions on them.

SIDEBAR Some language convention


Since this book will talk about data frames more than anything else, I prefer
using the non-capitalized nomenclature, i.e. "data frame". I find this to be
more readable than using capital letters or even DataFrame without a
space.
When referring to the PySpark object directly, I’ll use DataFrame but
with a fixed-width font. This will help differentiate between data frame the
concept and DataFrame the object.

This book will focus on the data frame implementation as it is more modern and performs faster

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
18

for all but the most esoteric tasks. Chapter 8 will discuss about trade-offs between the RDD and
the data frame. Don’t worry: once you’re learned the data frame, it’ll be a breeze the learn the
RDD.

Reading data into a data frame is done through the DataFrameReader object, which we can
access through spark.read. The code in displays the object, as well as the methods it exposes.
We recognize a few file formats: csv stands for comma separated values (which we’ll use as
early as Chapter 4), json for JavaScript Object Notation (a popular data exchange format) and
text is plain text.

Listing 2.3 The DataFrameReader object


In [3]: spark.read
Out[3]: <pyspark.sql.readwriter.DataFrameReader at 0x115be1b00>

In [4]: dir(spark.read)
Out[4]: [<some content removed>, _spark', 'csv', 'format', 'jdbc', 'json',
'load', 'option', 'options', 'orc', 'parquet', 'schema', 'table', 'text']

SIDEBAR PySpark reads your data


PySpark provides many readers to accommodate the different ways you
can process data. Under the hood, spark.read.csv() will map to
spark.read.format('csv').load() and you may encounter this form in the
wild. I usually prefer using the direct csv method as it provides a handy
reminder of the different parameters the reader can take.
orc and parquet are also data format especially well suited for big data
processing. ORC (which stands for Optimized Row Columnar) and Parquet
are competing data format which serves pretty much the same purpose.
Both are open-sourced and now part of the Apache project, just like Spark.
PySpark defaults to using parquet when reading and writing files, and
we’ll use this format to store our results through the book. I’ll provide a
longer discussion about the usage, advantages and trade-offs of using
Parquet or ORC as a data format in Chapter 6.

Let’s read our data file. I am assuming that you launched PySpark at the root of this book’s
repository. Depending on your case, you might need to change the path where the file is located.

Listing 2.4 "Reading" our Jane Austen novel in record time


book = spark.read.text("./data/Ch02/1342-0.txt")

book
# DataFrame[value: string]

We get a data frame, as expected! If you input your data frame, conveniently named book , into
the shell, you see that PySpark doesn’t actually output any data to the screen. Instead, it prints

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
19

the schema, which is the name of the columns and their type. In PySpark’s world, each column
has a type: it represents how the value is represented by Spark’s engine. By having the type
attached to each column, you can know instantly what operations you can do on a the data. With
this information, you won’t inadvertently try to add an integer to a string: PySpark won’t let you
add 1 to "blue". Here, we have one column, named value, composed of a string. A quick
graphical representation of our data frame would look like . Besides being a helpful reminder of
the content of the data frame, types are integral to how Spark processes data quickly and
accurately. We will explore the subject extensively in Chapter 5.

Figure 2.3 A high-level schema of a our book data frame, containing a value string
column. We can see the name of the column, its type, and a small snippet of the data.

If you want to see the schema in a more readable way, you can use the handy method
printSchema(), illustrated in . This will print a tree-like version of the data frame’s schema. It
is probably the method I use the most when developing interactively!

Listing 2.5 Printing the schema of our data frame


book.printSchema()

# root
# |-- value: string (nullable = true)

Same information, displayed in a friendlier way.

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
20

SIDEBAR Speeding up your learning by using the shell


This doesn’t just apply to PySpark, but using the functionality of the shell
can often save a lot of searching into the documentation. I am a big fan of
using dir() on an object when I don’t remember the exact method I want
to apply, like I did in .
PySpark’s source code is very well documented, if you’re unsure about
the proper usage of a function, class or method, you can print the doc
attribute or, for those using IPython, use a trailing question mark (or two, if
you want more details).

Listing 2.6 Using PySpark’s documentation directly in the REPL


In [*]: print(spark.read.__doc__)

Interface used to load a :class:`DataFrame` from external storage systems


(e.g. file systems, key-value stores, etc). Use :func:`spark.read`
to access this.

.. versionadded:: 1.4

In [*]: spark.read?
Type: property
String form: <property object at 0x1159a0958>
Docstring:
Returns a :class:`DataFrameReader` that can be used to read data
in as a :class:`DataFrame`.

:return: :class:`DataFrameReader`

.. versionadded:: 2.0

2.4 Exploring data in the DataFrame structure


One of the key advantages of using the REPL for interactive development is that you can peek at
your work as you’re performing it. Now that our data is loaded into a data frame, we can start
looking at how PySpark structured our text.

In , we saw that the default behaviour of imputing a data frame in the shell is to provide the
schema or column information of the object. While very useful, sometimes we want to take a
peek of the data.

Enter the show() method.

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
21

2.4.1 Peeking under the hood: the show() method


The most fundamental operation of any data processing library or program is displaying the data
it contains. In the case of PySpark, it becomes even more important, since we’ll definitely be
working with data that goes beyond a screenful. Still, sometimes, you just want to see the data,
raw, without any complications.

The show() method displays a sample of the data back to you. Nothing more, nothing less. With
printSchema(), it will become one of your best friend to perform data exploration and
validation. By default, it will show 20 rows and truncate long rows. The code in shows the
default behaviour of the method, applied to our book data frame. For text data, the length
limitation is limiting (pun intended). Fortunately, show() provides some options to display just
what you need.

Listing 2.7 Showing a little data using the .show() method.


book.show()

# +--------------------+
# | value|
# +--------------------+
# |The Project Guten...|
# | |
# |This eBook is for...|
# |almost no restric...|
# |re-use it under t...|
# |with this eBook o...|
# | |
# | |
# |Title: Pride and ...|
# | |
# | Author: Jane Austen|
# | |
# |Posting Date: Aug...|
# |Release Date: Jun...|
# |Last Updated: Mar...|
# | |
# | Language: English|
# | |
# |Character set enc...|
# | |
# +--------------------+
# only showing top 20 rows

The show() method takes three optional parameters.

n can be set to any positive integer, and will display that number of rows.
truncate, if set to true, will truncate the columns to display only 20 characters. Set to
False to display the whole length, or any positive integer to truncate to a specific
number of characters.
vertical takes a Boolean value and, when set to True, will display each record as a
small table. Try it!

The code in shows a couple options, stating with showing 10 records and truncating then at 50

©Manning Publications Co. To comment go to liveBook


https://livebook.manning.com/#!/book/data-analysis-with-python-and-pyspark/discussion
Random documents with unrelated
content Scribd suggests to you:
IX.

(Koronázási küldöttek, és a szent föld.)

Azalatt, míg mindenki ment a maga útján gyorsan: az a kicsi


ártatlan pünkösdi királyság – magyar világ is elsietett rohanva a
semmiségbe! Megint a derék németek, morvák, csehek,
galicziánerek, bezirkerek kerültek a sorba. A becsületesebb
magyarok leköszöntek, kenyér nélkül maradtak inkább, semhogy
megtagadják az alkotmányt – és szántottak, vetettek vagy koldultak.
Úr lett a bezirker!
Újra röpködtek a sasok és frakkok.
És ezekben a frakkokban a Baranyai testvérek és érdektársaik.
A német, a szerencsés, okos, filozof német nevetett és a fokosos,
csákányos bolond magyar lehorgasztott fővel búsult.
Követvilág, magyarvilág mint a füst és pára eloszlott.
A magyar igazán nem tudta: most már nevessen-e vagy
boszankodjék.
Mint Illés próféta: behuzódott odvába – és kesergett, várta mikor
megint villámlik; még egyszer megint mennydörög – és valaki
megint szalad a réten, a hegyen, az erdőn, a vizen, a sáson és –
nem csalódott!
Csehországban szörnyű nagy ködök jártak – s ezekből a rettentő
ködökből kitündöklött – soha eddig nem látott ragyogó fénynyel a
magyar alkotmány.
A felséges uralkodó 1867 julius havára koronázásra hívta össze a
magyart; kinevezte a felelős magyar miniszteriumot; megszüntetett
minden alkotmányellenes ideiglenességet. Ez volt a húsvét, ez volt
az ünnep!
A jó csehek, filozof németek, uzsorás galicziaik most már
csakugyan kitakarodtak az országból.
A magyar, a megkínzott, mindenéből kisajtolt, kiélt magyar – egy
ujjal se bántotta őket. Nem volt nálunk soha szicziliai vecsernye, se
Bertalan éj.
A magyar ehhez az európai magasabb mesterséghez – soha sem
értett.
Elbúcsúzott atyafiságosan a távozóktól; szívesen oda nyújtotta
kulacsát, kenyerét – barátságos, nemes, férfias kezét.
– De – mondá félig tréfásan, félig komolyan – adjon az Isten
nektek oda haza, a ti hazátokban – egy kissé jobb erkölcsöket! – És

Budára készült a nemzet királykoronázni.
Nagyban készült különösen Nagy-Kakasd.
Ki megyen már, hogy megyen már, kik lesznek a nagy-kakasdi
küldöttek? erről beszélt az egész város azon percztől fogva, hogy a
felhívó leirat megérkezett – örökké.
A követválasztás, ha szép volt, nagy volt, mert meg is érdemelte:
ez a kijelölés tízakkora volt. Hogyne, ő fogja kisérni a felséges
királyt, ott lesz mindenütt, a hol csak valami szépet látni lehet – s azt
itthon beszélni fogja nemcsak ő – a holta napjáig, de még a hatodik
unokája is.
Talpra is állott minden valamire való ember.
– Tisztelt közgyűlés, – állott fel a tanácsház nagy termében
Sebestyén uram –
– Halljuk!
– Tisztelt közgyűlés, én azt gondolnám, ilyen jeles
alkalmatosságra illő és törvényes dolog, hogy a tanács és a
közgyűlés a legrégibb kún családok közül válaszszon.
– Helyes! – zúgták a Hajkók, Bakosok, Halászok, Vargák, Kissek
és Nagyok.
– Legyen az, a kit küldünk –
– Kettőt küldünk –
– Kettőt. Tehát legyenek azok tiszta, valóságos kunok, a kik még
Kuthen királyunkkal jöttek be, mert vannak ilyenek –
– Vannak – emelkedtek fel a Nagyok és Kissek és Vargák –
vagyunk –
– A legelőkelőbbek, a kik a drága ruhát, fegyverzetet, lovat,
költséget a magunkéból kibirjuk, mert ez a tisztesség.
Erre sok ősi család szabó, varga és szíjgyártó ivadéka
elhallgatott, de annál inkább emelgette fejét és jártatta a híveken
villogó szemeit Hunyadi Gusztáv úr, ki többé hivatalt nem viselt, de
bizván a biztos jövőben, a takarékpénztár erős fedezete alatt
megmaradt várakozó magyarnak, ki mindenkor készséggel
csatlakozott azokhoz, kik évenként Lajos napjára gratulácziót küldtek
ki a legnagyobb magyarnak.
Hunyadi úr, ha nem is épen kun családból, de bizonyosan felette
régi családból származott. Intett tehát ide is, oda is, hogy e
tekintetben itt vagyok én.
– Továbbá – folytatta beszédét Sebestyén bácsi – a kiket
küldünk, azok szálas, megtermett, igazi magyar arczú emberek
legyenek, hogy ha a király rájuk találna nézni, hát maradjon rajtuk a
tekintete.
Ilyen már sok volt Nagy-Kakasdon.
Lett is mozgás a szép termetes deli kunfiak és apák között.
– Helyes! – kiáltották erre mindnyájan.
– Továbbá legyenek azok tiszta Kossuth magyarok, a kik soha
nem ettek német kenyeret, s a kik vérrel szolgálták a hazát.
– Helyes! – kiabáltak örvendezve sokan, kik ebbe az osztályba
tartoztak.
– Továbbá legyenek, azt gondolom uraim: talpig becsületes
emberek.
– Szót kérek, – döfött ujjával a polgármester felé Baranyai Albert
úr izgatottan és haragtól kipiruló orczával.
– Ez a Jóska bátyját ajánlja mindjárt, – súgtak egymáshoz a
Hajkók és Halászok nevetve.
– Azt, igen is József bátyámat ajánlom. Szeretném tudni, van-e
nálánál méltóbb erre a tisztességre? Ki ült tovább tömlöczöt? Ki volt
hívebb magyar –
– Ne beszéljünk arról itt Albert öcsém, – vágott szavába a
legvénebb Varga, – hagyjuk el azt a tömlöczöt. Szerencséje, hogy
még most is ott nem ül. A kutya ugat, de a pénz beszél. Félős, hogy
talál valamely ezüst vagy arany pénz valahol olyasmit is beszélni, a
minek a hallatára majd én fogom be a füleimet. A patika öcsémuram
jól fog – jó lesz a mellett maradni. Elfogadom a Sebestyén uram
beszédét. Válaszszunk régi igazi urat, becsületes embert, s ha mire
szüksége volna, s maga bugyellárisából talán tán nem birná:
összerakjuk. Én általengedem erre a jeles alkalmatosságra sárga
paripa lovamat.
– Én fegyvert adok, – állott fel Mészáros Simon, – egyenesen azt
a kardot, a melyikkel Árbocz leszúrta László királyt.
– Ha szabad volna nekem is ajánlanom valamit, – hajlongott
szerényen Hunyadi úr.
– Halljuk! – zúgták a takarékisták. – Halljuk a méltóságos urat.
– Díszmagyar ruhámat – –
– Könyörgöm, ha felolvashatom az utasítást, – szólalt meg a
városi főjegyző.
– Halljuk az utasítást.
– Fehér selyem attila, arany paszománt zsinórral, megyszín
nadrág – buzavirág, kék mente – –
– Ha szegényebb ifjút találna érni a választás, – emelkedék föl
Hunyadi úr, – én szívesen megkészíttetem öltözetét.
– Egyiknek jó lesz a méltóságos úr, – kiálták bátran a hívek.
Csitt!
Fogta be sok felháborodott érzésű kun ember száját e rettenetes
hatalom.
– Csitt! – hangzott a polgármesteri széken, tanácsbeli székeken;
– csitt! – zsongott e szép kis szó az ablakok mellett, hol a hatalmas
Hajkók ültek; – csitt! – hangzott a folyosón, a tanácsház előtt,
mindenütt, mindenütt, a hol csak pénzszükségben élő emberek
jártak és féltek egymástól.
Hunyadi Gusztáv ekkor már igen hatalmas ember volt.
Palotákat épített; földeket vásárolt kölcsön pénzen az apósa
kontójára – addig az időig, míg az ő napja eljő. A tanácsnál övé volt
az első szó; a városban mindennek ő volt az elnöke, iskoláknak,
egyháznak, dalárdáknak, gazdasági egyletnek, s a mi kicsiny egylet
vagy társaság csak előállhatott.
A pénz, a pénz – és százszor, ezerszer is csak a pénz.
A polgármester háta mögött egy kis kopasz ember mosolygott és
tekintgetett szerte, oly erős nézéssel, mintha valamit beszélt volna s
akarta volna, hogy ezt az a két pad ember értse is meg, a melyik a
polgárság zömét képezte a közgyűlésen.
Ez a kis kopasz ember Hayermayer, a gazdag néhai adószedő
főnök volt, a ki ide házasodott, itt maradt és magyar nevet vett föl és
a legdühösebb 48-as párthoz csatlakozott. Szidta Deák Ferenczet és
pártját és magasztalta Kossuthot, mert érezte, hogy ha egyszer
sokáig tartott a keserű, hát következnie kell az édesnek. Ő ugyan
azelőtt is mindig az édesből osztakozott, de mert abból akart
részesedni most is: lemondott hivatalról, penzióról, régi névről,
morvaországi rokonságról – és törekedett még nagyobb baloldali
magyar lenni, mint maga a legdühösebb – Deák ócsárló.
Igen hamar meg is nyerte az egész Nagy-Kakasd tiszteletét.
Főkép igen szép tőkepénzei voltak e tekintetben jó hatással a
népre.
Hayermayer úr most Harczos Pál József volt – apósa egy igen
derék vad magyarnak, Ősz Ádámnak, ki mint Bach világbeli főbiztos,
a legkegyetlenebb módon üldözte a kunt. Kilöketett irodájából
mindenkit, a ki magyarul mert beszélni, holott a szép német nyelvet
ő is csak karmolászta.

Ő Á
Oh be szép volt kormány-ünnepnapokon az az Ősz Ádám csinos,
kevély mitrovszki süvegével; bőrös oldalkardjával; haragos fekete
kun képével, és tört döczögő német szavaival. Egy kis
lovagkorbácskával járt mindig – s Nagy-Kakasd százszor láthatta és
látta is, mikor ez a dölyfös Bach-huszár az iskolából kijövő, – s neki
magyarul jó napot – dicsértessék a Jézust kivánó gyermekekre jókat
huzogatott, és törvényszerűleg oltogatta beléjük a német főneveket
és mellékneveket.
Most ez az Ősz Ádám is a legvéresebb szájú 48-as, s oly dühös,
hogy még béreseitől is határozott programmot követel – 48-czal.
Gazdag ember – és független. És független Magyarországot
követel.
Imádja Nagy-Kakasd.
Harczos Pál József közelebb int egy polgárt.
– Vörös Károly, – tudja mit? követeljen szavazást, és válaszszák
meg egyik koronázási küldöttnek Ádámot. A Czifrában este nagy
vacsora. Szóljon, szóljon.
Zsongás-bongás, mozgás, zúgás.
– Legyen az egyik küldött Méltóságos Ősz Ádám úr – kiáltja ki a
szót.
– Méltóságos Ősz Ádám úr –
– Halljuk!
Itt-ott rettenetes kaczagás.
– Kicsoda? – kiálták a Halász és Hajkó fiúk, a Sebestyének,
Szentpéteriek. Akkora zúgás, kaczagás, ordítozás támadt a
közönségben, hogy a polgármester gyűlés-felfüggesztéssel
fenyegetődzött.
– No ha ez megtörténnék, – szólalt fel hosszas szótkérések s
fölállások után a volt képviselő Ugodi Sándor, keményen dörzsölve
tüskés bajuszát – ha az uraim megtörténnék, de talán csak nem
fajult még el annyira a kun?
– Kövesse meg az úr magát, – rángatódzott Harczos-Hayermayer
úr, – én csak olyan kun vagyok, mint a tekintetes úr. A mi volt, az
elmult – ne bolygassuk, mert sok minden ki találna kerülni egyben is,
másban is. Én rég megtértem, hivatalomat elhagytam – pedig most
hatvanegytől fogva talán nem vállalhattam volna akár főispánságot?
nem tettem, magyar vagyok; csak olyan kun, mint az úr. A vőm meg
Ősz Ádám egyenesen levelezésben áll a legnagyobb magyarral. Most
is ki akart hozzá zarándokolni a tavaszon, de az őszre ki is megyünk.
Azt gondolom azért, hogy ha Hunyadi úr jó lesz banderistának, kun
banderistának – pedig ki merné azt állítani, hogy nem jó: hát az én
vőm Ősz Ádám, a ki a legkeményebb 48-as – szinte megülhet egy jó
kun paripát. Ajánlom vőmet. Igenis ajánlom.
– Ez mégis szemtelenség! – pattant fel székéről Mészáros Simon
úr.
– Ez gyalázat! – kiáltott a vén Hajkó. – Hát egy jött-ment
zsandárból, adószedőből, nyúzóból, a legnagyobb pecsovicsból,
németből, feladóból, spiczliből…
Harczos úr, rendes szokása szerint, azalatt míg gyalázták:
alázatos szavakkal és igéretekkel kereste a híveket, és gyűjtötte a
votumokat. Hallott ő mindent, de a mi előtte állott, az a czél volt,
hogy veje koronázási banderista legyen.
– Szót kérek! – ugrott előrébb a hosszas börtönt szenvedett
Baranyai József, s szöktek előrébb testvérei: Albert, Ábris és Mihály
teljes szófegyverzetben.
– Kérdem a közgyűléstől, – kezdé Baranyai József úr tajtékzó
ajkakkal, – mi akar itt készülni? Meggyalázása a magyarnak,
kigúnyolása kun őseinknek?

Ő
– Szavazzunk! – kiáltottak a Harczos és Ősz urak párthívei.
– Szavazzunk! – követelték a Hunyadisták. Baranyai úr tombolt,
üvöltött, szidta a németeket, gyalázta a pintlis apró kutyás Bach-
sereget, vágta a Schwindlereket és Hayermayerokat, Rundokat,
Randokat, Kucsekeket, Vacsekeket – dicsérte magát és emlegette
jutalmatlan martyromságát, hivatkozott a dicső multra.
– Nem jó azt a sarkot bántani uram! – hangzott valahonnan egy
szó, – mert sok eltett rabolt pénz –
– Itt nem lehet tanácskozni, ez czudarság! – üvöltöttek a
Baranyaiak, – személyeskedés, irigység – menjünk, oszlassuk fel a
gyűlést! – El, el! –
A becsületesebbek hallgattak, mosolyogtak és mormogtak
egymás közt.
– Igaz, a Baranyaiak sok rabolt pénzt eltettek – meg is kapták a
magukét. Bűn büntetlen nem marad. Szíhatják a fogaikat, de
szíhatják.
– Csúf dolog lesz, ha az a két Bach-huszár megy el kun-
banderistának.
– Meglássa István bácsi, – szól a beszélő öreg ősz kun atyafihoz
egy szép deli barna kun ifjú, – mert úgy lesz. Engem nem
választanak.
– Akkor Halász öcsém pörköljék is föl ezt a karaktertelen várost.
– Sok a pénz amott; Hunyadi, Harczos győzik pénzzel, – súgott
oda a hátuk mögött egy kun.
– Mi meg birjuk tán Varga bácsi becsülettel?
– Kicsit ér az ma! Hát szólaljon föl szomszéd? De úgy-e nem szól?
– Szégyenlem ilyen emberek közt. Inkább elmegyek.

É
– No úgy-e! Én is úgy vagyok.
– Tudom, rám úgy se hallgatna senki.
Az elnök csöngetett.
A küzdők sorakoztak; a szemek villogtak; a szívek hevültek;
Hunyadi úr nézte éles szemeivel a bajnokokat; Harczos Hayermayer
hol ide, hol oda suhant édes igéreteivel; a szép Hajkó és Halász fiuk
nemzetségeikkel futták a düh és bosszú tüzét; dobogtak a lábak, és
feszültek az izmok.
– Tisztelt közgyűlés! – kezdé a polgármester, – úgy látom ki van
merítve a disputa. Körülbelől el van döntve, hogy városunk kit
küldjön a koronázásra banderistának. Azt gondolom kettőt…
– Kettőt! – dörgött az alacsony füstös terem.
– Szavazásra bocsátom a dolgot, kinevezem a szavazatszedő
bizottmányt s ennek elnökét, és felkérem Tekintetes Varga Pál úr
elnöklete alatt Veres Károly és Harnócz polgártársainkat, hogy – – –
A zaj, a Hajkók, Halászok, Mészárosok, Sebestyének zaja,
morgása elnyelte a többit.
Megmozdult a tömeg kifelé, befelé, és zúgott, morajlott mint a
rémületes áradat.
A pénz!
Hunyadi úr az első veszteségen tanult. Több pénzt. Nagyon
megokosodott. Harczos úr is tudta, hogy a pénz csak úgy nincs
kiadva hiába, ha markunkban a jószág kötele.
Dologhoz látott tehát férfiasan, erélyesen.
Tizenegy óra tájt a polgármester úr ravasz alázatos képpel
kihirdette a szavazás eredményét.
– A közgyűlés banderistáknak a koronázásra megválasztotta
szavazattöbbséggel Méltóságos Hunyadi Gusztáv és Méltóságos Ősz
Ádám urakat, az elsőt hetven, az utóbbit hatvankét szavazattal.
– Ne neked vitéz magyar, szájas nagy-kakasdi atyafiság! –
mormogá kimenet az öreg Sebestyén, – megkaptad a karakteredért
a czímeredet.
Érd be vele!
A vérmesebbek, a dühösebbek lent a piaczi kút körül sereglettek
együvé, borzasztó szavakban fejezve ki rettentő megütődésüket.
Oda bent még egy más tárgy került szőnyegre.
Honnan vétessék az a szent föld, melyet ez ősi kun város a
koronázási dombhoz küldjön?
A vesztes fél elhagyta már a harcztért: Hunyadi és Harczos és
Ősz úr szabadon határozhatta meg a helyet.
Ekkorra már a nagy-kakasdi gyűléseknek szónoka, feje, vezére
egészen Hunyadi Gusztáv úr lett.
Fölállott tehát az ablak mellett, a Deák Ferencz képe alatt, mely
rendes helye szokott lenni – fölállott, ha az egész c görbületű
alázatos magatartást fölállásnak lehet venni és mágnásos
ropogtatásával a szép r betűnek: ekkép tette meg indítványát:
– Árbocz, az erős kun vezér, a mint a monda tartja: a szent-
jakabi pusztán porlad. Ott van sírja, koporsója. Én tehát azt
tartanám, hogy a szükséges földet innen küldenők s a László Károly
–––
– Helyes! – helyes! – erősíték élénk fejmozgatásokkal a
Hunyadisták.
– Hogyan? mi? – kérdé az épen visszatérő Halász Máté.
A polgármester fölfejtette a kérdés körülményeit.
– Nem lenne-e jobb uraim! ha már igazán ki akarunk tenni
magunkért, – mondá nevetve a vén ember, – ha azoknak a német és
cseh atyafiaknak a sírja tetejéből küldenénk egy láda földet, a kik a
Bach-világból itt maradtak? Mutassuk meg, hogy igazán
elaljasodtunk és valami féreg minden nemesebbet kiett a szívünkből.
Itt a Homok-erdő, a hol Huba vezér tetemei nyugosznak, hanem az
hogy érne fel egy elhullott cseh köszörűs porával? Nagy-Kakasd
úgyis híres már – legyen még híresebb.
Halász Máté úr égő arczczal és tántorgó léptekkel hagyta el a
tanácstermet. Nevetni, kaczagni, röhögni akart, de csak csuklott,
fuldokolt.
Hunyadi és Harczos úrék összenéztek – és mint nyertes felekhez
illő: mosolyogtak a vén eszelős bolondságain.
Természetesen határozatba ment, hogy a szent föld egyenesen a
László Károly úr pusztájáról a nádas ér melletti kis tölgyerdőcske
talajából vétessék.
Hunyadi úr ajánlotta, hogy ő ezt a szent földet kész ezüst
ládikában személyesen átadni az országos bizottmánynak – és pedig
a saját költségén.
– Igen, igen, – intett Harczos úr, – én tudom, hogy ezt az
áldozatot vőm is ezer örömmel megtette volna, de a dolog – igen,
igen a legjobb kezekben van.
Hunyadi ez újabb áldozatkészsége ismét nagy mértékben
megnyerte a nép tetszését.
Hunyadi úr és Ősz Ádám úr karonfogva vonult el a tüntetőleg
éljenző tömeg előtt, mely utálta a becsületes, nyers, de kevély,
rátartó Hajkó és Halász és Sebestyén nemzetséget és örömmel
hajolt meg a Bach-urak előtt, mert azok simák, hizelgők, adakozók
és barátságosak voltak.
– Éljen! – éljen! – hangzott az elismerő, lelkesült, jó kivánság és
még azoknak ajkairól is, kik imént a piaczi kút mellett a
legrettentőbb szavakkal szidták a Schwindler és Hayermayer és
Mitrovszki süveges ebeit.
Igen, mert Hunyadi és Ősz úr előttük ment el, és alázattal
meghajtotta magát mindegyik előtt – külön-külön.
A nép, mint a gyermek, megkivánja, hogy szeressék és
simogassák.
És Hunyadi úr is és Ősz Ádám úr is, e kemény 48-as, forrón
szerette a népet.
– Te Guszti! – nyomta meg Ősz Ádám úr Hunyadi úr karját, –
hitted ezt valaha?
– Lassan Ádám, mert meghallják, – nevetett a néhai Schwindler
úr.
– Szeretnék egy kunnak a nyakán menni föl Pestre. Te Guszti?
Nos?
– Kaphatsz jó pénzért eleget.
– De hogy Pestig korbácsolhatnám is. Te Guszti, vérig
korbácsolhatnám.
– Csitt! hallod, éljeneznek. Hajtsd meg magadat.
– Köszönöm, köszönöm barátim! – integetett kalapjával Ősz
Ádám úr, – valóban nem tudom, mikép köszönjem meg
kibeszélhetlen jóságtokat, kedves barátaim. Számítsatok reám. Éljen
a magyar, éljen a haza, éljen a mi apánk: Kossuth Lajos!
A két új magyar levette süvegét s a jó nép tiszta, őszinte
örömmel kiáltotta szíve mélyéből:
– Az Isten sokáig éltesse az ilyen igaz embereket! Az Isten ő
felsége áldja meg a nép embereit!!!
X.

(Kinek a kis fia vagy te?)

A nagy, ismét fényessé lett László-családban mindenki


megmozdult s mióta Hunyadi nemcsak mint koronázási küldött
pompázott fejedelmi díszruhájával, ősi kun fegyverzetével, drága
arab sárga paripájával, de mint a néhai Ugodi Sándor utóda a
követségben is tökéletesen megerősítette magát, és folyvást Pesten
tartózkodik grófok, bárók társaságában, és közelebbről már királyi
tanácsosi czímet is nyert: valóban az egész nemzetség a boldogság
napjait élvezi.
László úr tökéletesen átadta magát vejének.
Többé nem ilyen, meg amolyan, ezze, azza, hanem kedves
fiamuram! Ha így szólt: hát tegye fiamuram; ha amúgy helyesebb,
én belenyugszom.
Hogy is ne nyugodnék bele egy semmiből fölkapaszkodott,
uzsorás pénzekből fölgazdagodott, sötét multja által magát
mindenütt meggyűlöltetett ember, oly férfiú, országos kitünőség,
követ és királyi tanácsos (talán mégis csak majd egyszer igazi báró
is) intézkedéseibe, a kit mindenfelé a legnagyobb hódolat és tisztelet
környez?
Most Hunyadi úr építtet.
Államhelyiségeket építtet, postaházat, törvényszéki palotát –
nagy és biztos évi bérletekre, melyek a legszebb uzsorákkal
vetekedhettek.
Fölötte tetszetős dolog ez a fukar, kapzsi, pénzszomjas László
Károly úr előtt.
Hajnaltól késő estig az új épületek, tégla és porondhalmazok,
mészgödrök körül jár-kel, ragyogó orczával, az örömtől, szerencsétől,
boldogságtól – nemcsoda – egész megifjodva. Nem fél többet az
emberektől: hogy félne? mikor mindenki a legnagyobb tisztelettel
süvegeli, köszönti.
– Az emberek mindig jók, ott nincs hiba, csak mi el ne hagyjuk
magunkat, – okoskodék néha magában, a felette megvidámodott,
egykori zord Bach-főnök, és rettenetes adószedő. Nagy úri
nyájassággal köszönti ő is a szives kérdezősködőket, kik a nagyszerű
építkezéseknél csudálkozásaikkal és minden gazdagságot, hatalmat
vigyorgó, hódolatteljes mosolylyal fogadó elösmeréseikkel és
szerencsekivánataikkal itt is mint bárhol, megszoktak jelenni.
– Hogy lesz? mint lesz? ugyan pompás lesz!
Hogy tündököltek a kevély László úr szemei e dicső kérdésekre.
– A vőm, a fiam uram, a követ, a királyi tanácsos úr akarta, én
bele se mentem volna jó szerén, de ő, de ő – – hát teljék kedve –
felelé dicsekedő leereszkedéssel a dúsgazdag birtokos és tőkepénzes
úr.
Ez postaház lesz telegráf hivatalokkal és alant boltokkal: a
madarasi-utczában vendéglő épül kétemeletes, nagy báltermekkel,
kávéházakkal – mert erre fog jönni a vasút és innen fog lemenni
Erdélynek, Oláhországnak – ki, ki Konstantinápoly felé. A jövő nyárra
készen kell lenni a törvényszéki épületnek, hivatalokkal, börtönökkel,
erős börtönökkel hatvan-hetven perszonára. Igen, királyi
törvényszéket kapunk. A fiam ki fogja eszközölni.
Míg a hatalmas ember ily beszédek után a dicséreteket,
szerencsekivánatokat, oh-kat – ah-kat és édes isteneme-ket – Jézus
Máriá-kat fogadja polgároktól, hivatalnokoktól, bámuló és az irígység
miatt megpukkanó úri asszonyoktól – úgy mintha véletlenül
történnék, fel-fellépeget az emeleti falakra – s gúnyos kicsinylő
tekintettel mintegy oda téved a szolnoki utczába a Csákvár Mózes
boltja felé – a hol hasonlókép foly valami némi-némű építkezés.
Vajjon ki építtet ott?
Dr. Márton Sándor úr.
Most épen május derekán jár az idő, szépek a napok, melegek,
verőfényesek – alkalmatosan mehet úgy a nagyszerű, mint a
kisszerű építkezés.
A mint hogy megy is nagyon szépen.
Már a Márton dr. úr házacskájának a falai is rég kiemelkedtek a
földből, pedig olyan kevesen dolgoznak az épületen, hogy alig hallani
a lármájukat.
Ott áll az ifjú doktor úr. – Az ember azt hinné, hogy beteg vagy
valami nagy bánata van. Szemei inkább könyesek, mint ragyogók,
arcza komor.
Hát a szegényebb embernek, ha épít – akkor sem olyan nagy és
olyan tiszta az öröme, mint a gazdag birtokosnak? Pedig mikor lehet
egy férj boldogabb, mint mikor hajlékot épít övéinek.
Itt nincs járókelő, tudakozódó. Egy kis házacska nem igen költ
sem irígységet, sem kiváncsiságot.
Költhetne pedig. Im mily széles az a néhány lombos akáczfa mily
kellemes árnyékot fog hinteni a házacskára, a tornáczra, meg a
játszó gyermekekre. Arra beljebb a hosszan elnyuló kert; keleti
oldalán a gyümölcsös, a délin a veteményes jó kezek között szépen
megmutathatja, hogy mit tud. De most még rendezetlen. – Ekkora
helyt is sok boldog szív elférhet.
László Károly úr néz, merőn ide néz az éles szemeivel. Talán azt
látja, hogy Márton Sándor úr mily bús, hogy a doktor úr arcza mily
halavány.
Lehet, az ember sok mindent láthat, ha akar.
– S ennek adtam volna én az én egyetlen leányomat? –
mormogja magában László úr, mikor látja a szegényes építkezést, s a
kopott ruhás doktor urat.
Mosolyog. És ugyan egy szerencsés ember mért ne mosolyogna?
de mért ne kaczagna vagy akár egy-két élczes vidám gúnyolódó szót
mért ne mondhatna? Hát egy gazdag ember, a ki a legjobban adta
férjhez egyetlen leányát – vajjon ennyit se tehetne meg? Akkor mit
ér a vagyon, akkor mi haszon van az összezsugorgatott,
összekaparászott pénzben, ha még egy szivünk szerént valót se
nevethetnénk.
Én részemről azt hiszem, hogy a kinek vagyona van, summásan
pénze; a kit a szerencse – már mindegy akármilyen úton fölemelt:
annak szabad nevetni, csúfolódni, de sőt ezt jól felfogott érdeke,
díszes társadalmi állása is megköveteli.
Miről tudná meg a világ, hogy egy hitvány, csekély eszű, lelketlen
csaló, huzavona, alacsony ember ime fölemelkedett, kimosakodott a
nyomoruságból, állást, irígyelt, díszes állást foglalt el a
társadalomban: ha nem nevetne a vergődő kicsiny embereken s ha
azokat jól meg nem döfölné?
László úr nevet, s a legkeményebb, sértőbb szavakkal emlékezik
meg arról a tolakodó emberkéről, ki szemeit elég vakmerő volt az ő
egyetlen leányára emelni, s elég szemtelen volt még arra is gondolni,
hogy valamikor a nagy László-birtokokban mint tulajdonos, örökös
intézkedhessék.
Mikor egy gazdag felfuvalkodott, semmiből a sors kedvezése által
magasra jutott ember édes elandalodásában nevet, azt egyszerre
mint az égdörgést minden szegény, vergődő ember, főkép családapa
tartozik meghallani.
Meghallotta-e Márton úr? úgy lehet, mert az új posta-palota felé
fordult s bús tekintetével kereste a volt alfőnök urat.
Miért?
Hát mit néz a madár, mikor rád néz?
Talán semmit – és benned senkit.
Reggeli nyolcz-kilencz óra tájt járhat az idő.
Lombosak már a fák, szép magasak a sötét zöld vetések, és
mindjárt kaszálásra érettek a buja harmatos rétek.
Hunyadi Gusztávné künn lakik a pusztán. Míg férje Pesten szerzi
a dicsőséget, apja bent palotákat emel: ő anyjával a nehéz
gazdaságot vette át.
A mit leánykorában unalmasnak, parasztos dolognak talált, hogy
a munkásokat felügyelje, azokra főzessen, vajat, turót, sajtot
készítsen, baromfiakat tartson, sok sok csirkét, pulykát, réczét, libát
költessen, és gondolkodjék, hogy a legjobb fajú zöldségnemeket
termeszsze a szentjakabi kövér gazdag földben: most itt e lombos
fák, zöldellő vetések, dús kerti növények, zsibongó, zajongó
majorságok oh mennyi, és mily édes örömet adnak lelkének.
Korán kel, s mikor a cselédség és a munkásnép dologra indul,
már ő rég megjárta a kertet, udvart, az illatos mezőt, a harmatos
búzatáblákat.
A szentjakabi pusztán kétszeres kedvvel dolgozik a munkás, mert
jól fizetik, jó étellel tartják s a kinek gyermeke van – beadhatja a
nagyságos asszony keze alá, ki egy kis iskolában maga tanítja,
gondozza a cselédek és munkások gyermekeit.
Az egykor annyira elhervadt László Vilmát, a ki a fényes esküvő
utáni napokban és esztendőkben látta csak: az, ha ma látná, meg
nem ösmerné.
Im ott jön a magas sűrű rozs között, egy keskeny csapáson. Jön
visszafelé a munkásoktól, a kiknek most adatta ki a reggelit.
Széles, lehajló szalmakalap árnyalja be pirosas telt barna arczát;
magas kifejlett, erőteljes termetét apró kék pettyes fehér falu köntös
fedi. Sebesen, vidámon tart a puszta felé, karján egy kis kosárkát
hintázgat, melynek tartalmát bizonyosan a munkások köszönték
meg.
Sötét apró szemeiben nyoma sincs a komorságnak; ajkain mosoly
játszik, az a mosoly, mely a lélek nyugalmát, vagy legalább
tisztaságát hirdeti.
– Vigyázz fiúcska, bele ne essél a vízbe, – kiált Hunyadiné egy
hat-hét évesnek látszó gyermekre.
– Nem nem néni, nem esem bele, Bella sem esik.
– Hát kinek a kis fia vagy te?
– Én, meg Bella, – mutatott a szép szőke fiúcska egy öt évesnek
látszó kövér piros barna leánykára, – hát maga azt sem tudja néni,
hogy mi kinek a gyerekei vagyunk?
– Nem kis fiacskám.
S azzal ölébe kapta a kis bámuló leánykát, hogy csókjaival borítsa
be a nap sütötte szép kis barna arczot.
– Mi is itt lakunk nem messze; vasárnap hozott ki bennünket apa,
s itt is fogunk maradni az egész nyáron, mert a mama nagyon beteg.
– Jőjjön hozzánk néni, – gyögyögé a kis lányka, – én elvezetem
mamához. Ott ni, ott lakunk.
– Hát várj Bella, fogjunk előbb egy halat. Itt ám sok van. Ni,
látod, mozog a dugó. Ehen!
– Kis hal – szökött utána édes kiáltással a leányka. Néni, kis hal.
S szorította kövér kis kezecskéjébe a viczkándozó halacskát.
– Néni, mikor apám kijő, annak is szabad lesz itt halászni?
– Szabad kis fiú.
– Nem haragszik néni, hogy István ide hozott bennünket?
Egyszeribe itt lesz ő is. Csak buzogányt vág amott.
– Nem, nem kis fiú. Mindennap jertek ide.
– Jőjjön hozzánk néni, ott ni, ott lakunk. Mama nagyon beteg.
A néni megfogta a kis leányka kezét, s valamely mély belső
parancstól vezéreltetve – ment a gyerekekkel.
Néhány percz mulva belépett a kis nádas házikóba.
– Vilma! – kiáltott egy elszáradt asszony.
– Vilma! – kiáltott egy elszáradt asszony.

– Bella! – ugrott a beteg felé Hunyadiné.


Sokáig zokogott a két nő, az elhervadt, elsorvadt, egykori szép
Bella, s a megifjult, megszépült László Vilma.
A gyerekek oda kapaszkodtak a két nőre és mivel nem tudták,
hogy azok mért sírnak: hát sírtak egy kicsit ők is.
– Haragszol-e még? – susogá erőtlen hangon Bella, görcsösen
szorítva magához egykori barátnéját.
Vilma nem tudott szóhoz jutni, újból és újból elfordult, hevesen
zokogott és kezeibe rejté könyborította arczát.
– Néni, ne sírjon, – simogatá a kis leányka – ne haragudjék,
vissza adom a halat – ni fogja, és Vilmos se fog több halat, ha néni
haragszik.
– Nem, nem, kicsi angyalom, – fogta ölébe a szép gyermeket, és
szorítá magához erősen, – én senkire sem haragszom.
– Hát akkor mért sír?
– Ne sírjon, – kérlelé a fiúcska.
– Látod, hogy szeretnek ezek a gyerekek, édes Vilmám.
– Mért sír a néni? – kérdé a kis Bella anyját, – mondja mama, ne
sírjon, ne haragudjék.
– Haragudott, sokáig, nagyon sokáig haragudott ez a szép, szép
néni mi reánk kis leányom, – de többet nem fog haragudni. Ide
vezette az a jó isten, a ki mindent megbocsát. Csókoljátok meg
ennek a szép néninek a kezeit – mert ez a ti kis mamátok.
– Úgy? – kérdé egyszerre a két gyerek örömtől ragyogó arczczal,
– hát maga is a kis édes mamánk lesz?
– Az Vilmoska, kicsi Bella.
– És itt marad: apa úgy sincs itt, és ha jön is, neki mindig menni
kell.
– Édes Bellám! – ölelé át forró szeretettel Vilma – ne légy bús, itt
hamar meggyógyulsz. Én is sokáig beteg voltam, most istennek
köszönöm, egészen jól vagyok.
– Be szép vagy Vilma! – tapogatá a beteg nő barátnéja telt
karjait.
– Te is az vagy édesem. És nézd, mily szépek gyermekeid.
– Jók, – mondá az anya, azon a hangon, mely a szomorú búcsú
hangja. – Meghűtöttem magamat. A lakásunk nedves volt. Most
Sándor újat építtet. Ott talán – – úgy-e édes Vilmám – – hozzátok be
Vilmoska a fehér nyulat, te is Bellácska – segíts, fogjátok meg,
István megfogja – – –
– Megbocsátasz-e nekem Vilma? nem vagyok bűnös, az a jó isten
látja, a kihez nemsokára el fogok menni! Mindig szeretett Sándor,
még azután is sokáig, mikor te már rég férjhez mentél és nem vett
volna el engemet soha, ha nem látja, hogy én nagyon-nagyon
szeretem és valakitől ezt meg nem tudja. Ugy-e boldog asszony
É
vagy? Én nagyon boldog vagyok. Sándor soha sem bántott tégedet
édes Vilma csak egyetlen gondolattal is – azért, hogy te máshoz
mentél. Csak szerette volna megmondani, hogy ő ártatlan, hogy a
mit róla mondtak, hogy atyádat kissebbítette – az nem igaz.
– Tudom – –
– Oh Vilma képzeld, ő most is úgy őrzi a leveleidet – de nem
haragszom érte. Azok igen szép levelek. Oh Vilma – tudod-e, hogy ő
nekem mindig elmondta, ha tégedet valahol látott? tudod-e, hogy
Vilmosnak te – de azt talán nem is volna szabad megmondanom – –
– Mama – lépett be a szóra a kis nyúllal a fiú – mit nem szabad
megmondanod?
– Hogy ez a szép néni a te kereszt mamád – –
– Úgy? hát akkor néni maga az én keresztmamám, és akkor fogja
ezt a kis fehér nyulat, magának adom. De elvisszük a társát is.
Ölelés, csók, kaczagás – –
– Apa, itt van apa, szökött ki mint a mókus az élénk gyermek – a
kocsiról leszálló apjához.
XI.

(De most már igazán báróné lesz.)

Kis gyerekek nem igen tudnak arról, hogy a mama nagyon beteg
ám! A sápadt beteges arczot megszokják. Oh, hogy sejtenék ők az
alatt a kibeszélhetetlen veszteséget? Nevetnek, ha van min – és
gyereknél hogyne volna ilyen? Rendel a jó isten örökké, mert szereti,
hogy a kicsinyek semmit se lássanak a sötétből.
A kis Vilmos és Bella még a piros szemű, fehér köntösű nyulakról
is megfeledkezett – futott, futott át a nénihez, az új mamához. Ott
egy csomó gyerek volt, leány és fiú, a kik két hosszú asztal mellett
írtak, olvastak és énekeltek.
Tanította őket a néni.
Vilmos és Bella is beállott a béres és munkás gyerekek közé.
Bellát oda vette a néni az ölébe s a kis leányka forró szeretettel –
mintha édes anyját ölelné – kulcsolta át az új mama nyakát s leste
tekintetét, szavait.
A leányka kisebb volt még, semhogy valami nehezebbet tanuljon,
de arra elég nagy, hogy mindenre figyeljen és minden zajban,
mozgásban, mosolyban gyönyört találjon.
Hunyadiné az alatt, míg beszélte a szebbnél szebb történeteket a
bibliából, Kainról és a szegény Ábelről, Józsefről, a kit testvérei
eladtak és Dávidról, a ki kicsiny létére az Úr segítségével olyan
szépen eltalálta a nagy óriást: valami soha nem érzett melegséget
talált a kis gyermek gömbőlyű karocskájában és puha pirosas
ujjacskáiban. Hagyta, hogy a leányka üljön ott, és meg nem
mozdította volna a nyakát a világért is.
– Nénimama, most már énekeljünk, – kiáltott oda Vilmos a
gyerekek közül, – és feltartotta hosszú fehér kis kezét, hogy indítson.
És megzendült egy szép gyermek-ének a vadgalambról, a mely
szereti a zöld erdőt.

Zöld erdő, zöld erdő


A kedves lakásom.
Rosz ember, rosz ember
Engem sohse lásson.

Kis fiam neveljem,


Patakvizre vigyem,
Szép hűvös patakról
Búza földre tegyem.

Míg a dal zengett, harsogva mint a zöld erdős kőszikláról


lezuhanó patak és nem akart, és nem tudott megállani mint a madár,
a melyik szép vidékről még szebb vidékre siet – egy ember állott az
ajtóban levett kalappal, mosolyogva, szemeit egy pontra, a
tanítónénire függesztve.
Egy-két munkás gyerek intett a plajbászával, hogy ni: ott valaki
van, egy úr, de mire elvégezték az éneket – s a tanítónéni is észre
vehette a dolgot – az idegen eltünt. Senki se tudta és senki se látta
merre.
Ott megy a jegenyefák mentén az ér mellett, mely a Hajkó és
Sebestyén birtokot a László pusztától elválasztja.
Dr. Márton Sándor úr.
Kalapját most is kezében tartja s úgy ballag az árnyékban. Sűrű
tömött hajában alig látszik még egy-egy ősz szál, szakálla tömött,
bajúsza ép, ment az öregedésnek jeleitől. – De homlokát erős vastag
redők szántják keresztbe s szemei mint a sok gonddal és bajjal élő
embereknél szokott lenni: zavarosak, törődött fényűek, mintha
könyekben úsznának.
Visszagondol a multra – a letölt tizenhat, tizenhét évre.
Hol volna most, ha egy rosz ember ide nem kerül? ha nem olyan
bizodalmas egy idegen iránt? ha a legelső sértésre vissza nem
vonul? ha szembe száll az akadályokkal? ha felvilágosítást kér
férfiasan és részéről is magyarázatot ád? ha nem a daczban, az
öntudat kevélységében talál menekvést és védelmet? ha – –
– Nem! – sohajt homlokát törülgetve a megtermett vállas,
erőteljes ember – nem vádolom a sorsot – nem – –
De oda bent a szívnek minden elfojtott joga egy perczre talpra
szökik.
És szavakat mond, kemény metsző, sértő szavakat, melyekre
felelni – képtelenség.
– Gyáva voltál –
– Nem, csak szemtelen nem akartam lenni.
– Hűtelen voltál –
– Nem, csak követelni nem akartam.
– Szerencsétlenné tettél egy nőt, kit hidegséged által oda vetettél
egy gonosz ember karjai közé – –
– Nem – ő utasított vissza.
– Hazudsz!
Márton úr félre kapta a fejét, mintha egy fa mellől valaki igazi
hangon kiáltotta volna e szót.
– Hazudsz – hangzott újra, – hazudsz, hazudsz – –
Márton úr fölcsapta a fejére kalapját és sietve vágott be egy
oldalon a bükköny-földek között, hogy minél előbb elérje azt a
tanyát, hol beteg felesége feküdt.
Elbeszélt úgy-e mindent? a mit látott? hogy a gyerekek mit
csinálnak? milyen jó helyt vannak? Hogy az a szegény asszony
milyen áldott egy teremtés?
Nem, egyetlen szót, csak egy kicsiny szócskát sem mert mondani
az egészből.
Miért nem?
Oda ült alázatosan, de vergődő nyugtalan szívvel beteg felesége
ágya szélére, megragadta a szelíden mosolygó anyának elszáradt –
hideg kezeit és sokáig sokáig beszélt a gyorsan készülő új épületről,
a helyesebbnél-helyesebb tervekről, a czélszerű berendezésről, a
konyhakertről, a virágos kertről, egy szivárványos kútról, melyből
gumicsövekkel lehet az öntözést bármikor végezni.
– A konyha legyen nagy és világos –
– Igen. A kertben fogok egy szép filagoriát csináltatni. Ott
reggelizhetünk és vacsorálhatunk.
A nagy beteg, bár határozottan soha sem hiszi el, hogy beteg:
kedves tervek és remények valósulása küszöbén egy perczre
elkomorodik, s egy szempillantásra maga előtt látja – a koporsót.
Szerencsére egy röpke szempillanatra csak.
– A varrógépet – nyögé lassú hangon a beteg nő.
– Azt nem fogjuk többé betenni. Kivettetem.
Bella könyein át hálásan mosolygott és megszorította férje kezét.
– De csak addig, míg jobban leszek. A gyerekeknek én akarom
varrni a fehérneműiket. Másnak nem engedném. Soha-soha.
– Kevesebbet beszélj édesem, nem szabad magadat felizgatnod.
Úgy kellene, hogy a jövő hó derekán fürdőre menjünk.
A beteg asszony hirtelen fölemelkedett, s mintha menekülni akart
volna egy képtől, egy alaktól – rögtön szaván fogta a doktor urat:
– Igen, a gyerekeket is viszszük. Jobban is vagyok. Azt
gondolnám –
Szegény asszony úgy sietett, úgy szökött volna e helyről, hol
gyermekei oly boldogan töltik napjaikat. Akárhova, akármerre, ha így
ezzel a beteg ágygyal is – csak oda, a hol egyedül lesznek, egyedül.
Nem egyedül, csak ama tanítónéni nélkül.
– Oh istenem, – mormogja mosolyogva némi szánalommal
olvasóm.
– Semmi oh istenem, és semmi szánakozás.
Egy anyának, a ki határtalanul szereti férjét és gyermekeit – joga
van követelni, hogy azokat a gyerekeket senki se mulattassa,
simogassa, szeresse és csalogassa; joga van követelni, hogy arra az
emberre semmiféle nő különös szemekkel ne nézegessen – igenis ne
nézegessen.
Minden nő elégedjék meg a maga választotta férjével, és ne
kivánja a más nő kis gyermekeit elédesgetni, mert a mely embernek
a gyermekeit egy asszony igen szereti: hát ott, azt a férjet, azt az
embert – igen!

You might also like