0% found this document useful (0 votes)
7 views

Download Complete Data Storytelling with Generative AI using Python and Altair MEAP V05 Angelica Lo Duca PDF for All Chapters

The document promotes the ebook 'Data Storytelling with Generative AI using Python and Altair' by Angelica Lo Duca, which focuses on practical approaches to data storytelling, utilizing Python's Altair library and Generative AI tools. It emphasizes the importance of transforming data into engaging narratives to enhance communication and decision-making. The book also includes practical examples and aims to improve readers' data visualization skills and storytelling capabilities.

Uploaded by

abarranesuxr
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Download Complete Data Storytelling with Generative AI using Python and Altair MEAP V05 Angelica Lo Duca PDF for All Chapters

The document promotes the ebook 'Data Storytelling with Generative AI using Python and Altair' by Angelica Lo Duca, which focuses on practical approaches to data storytelling, utilizing Python's Altair library and Generative AI tools. It emphasizes the importance of transforming data into engaging narratives to enhance communication and decision-making. The book also includes practical examples and aims to improve readers' data visualization skills and storytelling capabilities.

Uploaded by

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

Get the full ebook with Bonus Features for a Better Reading Experience on ebookgate.

com

Data Storytelling with Generative AI using Python


and Altair MEAP V05 Angelica Lo Duca

https://ebookgate.com/product/data-storytelling-with-
generative-ai-using-python-and-altair-meap-v05-angelica-lo-
duca/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookgate.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

ScyllaDB in Action MEAP V05 Bo Ingram

https://ebookgate.com/product/scylladb-in-action-meap-v05-bo-ingram/

ebookgate.com

Storytelling with Data 1st Edition Cole Nussbaumer Knaflic

https://ebookgate.com/product/storytelling-with-data-1st-edition-cole-
nussbaumer-knaflic/

ebookgate.com

How Machine Learning Works MEAP V05 Mostafa Samir Abd El-
Fattah

https://ebookgate.com/product/how-machine-learning-works-
meap-v05-mostafa-samir-abd-el-fattah/

ebookgate.com

Data Science Fundamentals with R Python and Open Data 1st


Edition Marco Cremonini

https://ebookgate.com/product/data-science-fundamentals-with-r-python-
and-open-data-1st-edition-marco-cremonini/

ebookgate.com
The Complete Obsolete Guide to Generative AI 1st Edition
David Clinton

https://ebookgate.com/product/the-complete-obsolete-guide-to-
generative-ai-1st-edition-david-clinton/

ebookgate.com

OpenCV with Python blueprints design and develop advanced


computer vision projects using OpenCV with Python 1st
Edition Michael Beyeler
https://ebookgate.com/product/opencv-with-python-blueprints-design-
and-develop-advanced-computer-vision-projects-using-opencv-with-
python-1st-edition-michael-beyeler/
ebookgate.com

Data Mining with Python Theory Application and Case


Studies 1st Edition Di Wu

https://ebookgate.com/product/data-mining-with-python-theory-
application-and-case-studies-1st-edition-di-wu/

ebookgate.com

Practical SQL A Beginner s Guide to Storytelling with Data


2 / converted Edition Anthony Debarros

https://ebookgate.com/product/practical-sql-a-beginner-s-guide-to-
storytelling-with-data-2-converted-edition-anthony-debarros/

ebookgate.com

Prompt Engineering for Generative AI Future Proof Inputs


for Reliable Al Outputs 1st Edition James Phoenix

https://ebookgate.com/product/prompt-engineering-for-generative-ai-
future-proof-inputs-for-reliable-al-outputs-1st-edition-james-phoenix/

ebookgate.com
Data Storytelling with Generative AI
1. welcome
2. 1_Introducing_Data_Storytelling
3. 2_Running_your_first_data_story_in_Altair_and_GitHub_Copilot
4. 3_Reviewing_the_basic_concepts_of_Altair
5. 4_Generative_AI_Tools_for_Data_Storytelling
6. 5_Crafting_a_data_story_through_the_DIKW_Pyramid
7. 6_From_Data_to_Information:_Extracting_insights
8. 7_From_Information_to_Knowledge:_Building_textual_context
9. 8_From_Information_to_Knowledge:_Building_the_visual_context
10. 9_From_Knowledge_to_Wisdom:_Adding_Next_Steps
11. 10_Publishing_the_Data_Story
12. Appendix_A._Technical_Requirements
13. Appendix_B._Python_Pandas_DataFrame
welcome
Thank you for purchasing the MEAP for AI-Powered Data Storytelling. This
book combines three fundamental elements: Data Storytelling, Python, and
Generative AI to guide you toward building engaging data stories.

Data Storytelling is the main focus of this book. Many good books exist on
the market about this topic, especially focusing on the theory of data
storytelling. This book, instead, describes a practical approach to elevate your
basic data visualization skills and transform you into a data storyteller. In this
book, you will use the Data-Information-Knowledge-Wisdom (DIKW)
pyramid as a practical method to transform simple data visualization into data
stories. When I met the DIKW pyramid some years ago, I fell in love with it,
and since then, I have been using it as a teaching method for my students.

Python is the second ingredient of this book. As a data journalism professor, I


have experimented with many Python libraries for data visualization, such as
Matplotlib, Plotly, and Seaborn. However, at the end of my experiments, I
realized that the simplest library for data visualization is Altair. Unlike other
libraries, Altair is declarative, thus enabling you only to focus on the output
of your data visualization. Thus, this book will focus on Altair to build data
visualization. Although you can find many materials on the web about Altair,
they focus only on how to build raw charts. In this book, you’ll learn how to
build data stories with Altair and not simply raw charts.

Last but not least, you’ll learn how to use Generative AI tools for data
storytelling. This book won’t focus on Generative AI concepts and theory.
Instead, you will learn how to apply Generative AI tools, including GitHub
Copilot, ChatGPT, and DALL-E, to data storytelling.

Finally, throughout AI-Powered Data Storytelling, you’ll implement many


practical examples that will ease your learning process and make your
journey more fun.

To benefit most from this book, you’ll want to have some basic experience in
Python and basic knowledge about Pandas and data visualization. Even if you
don’t have such basic knowledge, you can still read this book, assimilating
the basic concepts of data storytelling and then using them with other tools or
programming languages.

I hope you find it as useful to read as I did to write it. Please be sure to post
any questions, comments, or suggestions you have about the book in the
liveBook discussion forum. Your feedback is essential in developing the best
book possible.

—Angelica Lo Duca

In this book

welcome 1 Introducing Data Storytelling 2 Running your first data story in


Altair and GitHub Copilot 3 Reviewing the basic concepts of Altair 4
Generative AI Tools for Data Storytelling 5 Crafting a data story through the
DIKW Pyramid 6 From Data to Information: Extracting insights 7 From
Information to Knowledge: Building textual context 8 From Information to
Knowledge: Building the visual context 9 From Knowledge to Wisdom:
Adding Next Steps 10 Publishing the Data Story
Appendix A. Technical Requirements Appendix B. Python Pandas
DataFrame
1 Introducing Data Storytelling
This chapter covers
Overview of data storytelling
The importance of data storytelling
Why you should use Python Altair and Generative AI tools for data
storytelling
When Altair and Generative AI tools are not useful for data storytelling
How to read this book
The DIKW pyramid

Data storytelling is a powerful way to share insights by transforming them


into narrative stories. Data storytelling is an art you can use for any industry,
such as government, education, finance, entertainment, and healthcare. Data
storytelling is not only for data scientists and analysts; it’s for anyone who
has ever wanted to tell a story with data.

1.1 The Art of Data Storytelling


Data scientists and analysts often allocate little time and attention to data
presentation. Frequently, throughout a data science project, we devote most
of the time and resources to preprocessing the data, followed by data
analysis, and lastly, data presentation. Unfortunately, this often entails
presenting graphs generated during the analytical phase to the audience,
resulting in limited engagement and understanding. Figure 1.1 shows the
journey from data to the intended audience, as viewed through the eyes of
both the skilled data scientist (represented on the left) and the eagerly
awaiting audience (represented on the right). The flow consists of three major
phases: data preprocessing, analysis, and presentation. The size of each box
reflects the amount of time devoted to its respective phase. While data
scientists and audiences share a common goal (that is, to grasp the essence of
the data truly), how they achieve said goal varies. Data scientists understand
data during the data analysis phase, whereas audiences take center stage
during data presentation.

Figure 1.1 The data science flow from the data scientist’s perspective (on the left) and the
audience’s perspective (on the right)

Data storytelling can help data scientists and analysts to present and
communicate data to an audience. You can think of data storytelling as the
grand finale of the data science life cycle. It entails taking the results of the
previous phases and transforming them into a narrative that effectively
communicates the results of data analysis to the audience. Rather than relying
on dull graphs and charts, data storytelling enables you to bring your data to
life and communicate insights compellingly and persuasively.
More formally, data storytelling builds compelling stories supported by data,
allowing analysts and data scientists to present and share their insights
interestingly and interactively. The ultimate goal of data storytelling is to
engage the audience and inspire them to make decisions. In some cases,
including business scenarios, you do not start from data but from a narrative
or a hypothesis you have in mind and then search for data that confirm or
negate it. In this case, you can still have data storytelling, but you must pay
attention not to alter your data to support your hypothesis. Brent Dykes, a
well-known consultant in storytelling training, suggests: Whenever you start
with the narrative and not the data, it requires discipline and open-
mindedness. In these scenarios, one source of risk will be confirmation bias.
You will be tempted to cherry-pick data that confirms your viewpoint and
ignore conflicting data that doesn’t (Dykes 2023). Remember to build your
data stories on accurate and unbiased data analysis. In addition, always
consider the data you are analyzing.

Some time ago, I had the opportunity to work on a cultural heritage project
where I had to automatically extract entities from the transcripts of a registry
of names dating back to around 1700-1800. The goal was to build a database
with information about the people in the register, such as name, surname,
date of birth, date of death, etc. Sitting at my computer, I implemented my
software, built the table with all the names, and calculated and visualized data
statistics, such as the most frequent names, the number of births per year, etc.
The project also involved linking these people to their graves to build an
interactive cemetery map. At some point in the project, I had the opportunity
to visit the cemetery. As I walked through the cemetery, the rows upon rows
of headstones made me stop. It hit me like a ton of bricks - every name
etched into those stones represented a life. Suddenly, the numbers and
statistics I had been poring over in my data sets became more than just data
points - they were the stories of real people. It was a powerful realization that
changed the way I approached my work. That's when I discovered the true
power of data storytelling. It's not just about creating fancy graphs and charts
- it's about bringing the people behind the data to life. We have a mission to
give these people a voice, to ensure that their stories are heard. And that's
exactly what data storytelling does - it gives a voice to people often buried
deep within the numbers. Our mission as data storytellers is to bring these
stories to the forefront and ensure they are heard loud and clear.
In this book, you’ll learn two technologies to transform data into stories:
Python Altair and Generative AI tools. Python Altair is a Python library for
data visualization. Unlike the most known Python libraries, such as
Matplotlib and Seaborn, Altair is a declarative library where you specify only
what you want to see in your visualization. This aspect is beneficial for
quickly building data stories without caring about how to build a
visualization. Altair also supports chart interactivity so that users can explore
data and interact with it directly.

Generative AI is the second technology you’ll use to build data stories in this
book. We will focus on ChatGPT to generate text, DALL-E to generate
images, and GitHub Copilot to generate the Altair code automatically. We
chose to use GitHub Copilot to generate code and not ChatGPT because
Copilot was trained with domain-specific texts, including GitHub and
StackOverflow codes. Instead, ChatGPT is more general purpose. At the time
of writing, Generative AI is a very recent technology, still in progress, that
translates a description of specifications or actions into text.1.2 Why Data
Visualization Alone Is Not Enough

Data storytelling is about more than just communicating data. It's about
inspiring your audience and inviting them to take action. Good data
storytelling requires a mix of art and science. Art comes in finding the right
story, while science understands how to use data to support that story. When
done well, data storytelling can be a potent tool for change. In this section,
we’ll briefly cover three fundamental questions about data storytelling.

1.1.1 Why Should You Use Data Storytelling?


More often than not, we delay data visualization until the last stage of our
data analysis process, when we're tired and exhausted from the other stages of
our project. As a result, we produce running graphs, which more or less
represent our data. Figure 1.2 shows an example of such a running chart,
where it is really difficult to extract a meaning.

Figure 1.2 An example of a bad chart


In other cases, we build dashboards that simply juxtapose charts next to each
other without any sense or logic (Figure 1.3).

Figure 1.3 An example of a bad dashboard


There is often the erroneous belief that if a chart is aesthetically beautiful,
then it is certainly also useful. This isn't exactly true. In his book The
Functional Art, Alberto Cairo says: If you accept that a visualization is,
above all, a tool, you are implicitly accepting that the discipline it belongs to
is not just art, but functional art, something that achieves beauty not through
the subjective, freely wandering self-expression of the painter or sculptor, but
through the careful and restrained tinkering of the engineer (Cairo 2012).

Data Storytelling allows you to fill the gap between simply visualizing data
and communicating it to an audience. Data storytelling improves your
communication skills and standardizes and simplifies the process of
communicating results, making it easier for people to understand and
remember information. Data storytelling also helps you learn to communicate
more effectively with others, improving personal and professional
relationships.

Use data storytelling if you want to:

Focus on the message you want to communicate and make data more
understandable and relatable
Communicate your findings to others in a way that is clear and
convincing
Connect with your audience on an emotional level, which makes them
more likely to take action
Make better decisions by helping you understand your data more deeply.

1.1.2 What Problems Can Data Storytelling Solve?


Use data storytelling if you want to communicate something to an audience
in the form of writing reports, doing presentations, and building dashboards.

Writing Reports

Imagine you must write a sales report for a retail company. Instead of
presenting raw numbers and figures, you can weave a data story around the
performance of different product categories. Start by identifying the most
crucial aspects of the data, such as the top-selling products, emerging trends,
or seasonal fluctuations. Then, use a combination of visualizations,
anecdotes, and a logical narrative flow to present the information.

You can build a story around your data, such as introducing a problem,
building suspense, and concluding with actionable recommendations.
When writing reports, use data storytelling to highlight the most important
parts of your data and make your reports more engaging and easier to
understand.

Doing Presentations

Consider a marketing presentation where you must demonstrate various


marketing campaigns' effectiveness. Instead of bombarding the audience with
numerous charts and statistics, focus on creating a compelling narrative that
guides them through how the campaigns unfolded and their impact on the
target audience. Finally, show the possible next steps to follow.

When doing presentations, use data storytelling to engage your audience and
help them understand your message better.

Building Dashboards

Let's imagine you are developing a sales performance dashboard for a retail
company. Instead of presenting a cluttered interface with overwhelming data,
focus on guiding users through a narrative highlighting key insights.

When building dashboards, use data storytelling to build more user-friendly


and informative dashboards.

1.1.3 How Is Data Storytelling Different From Data


Visualization?
Data visualization is primarily concerned with presenting data in a way that is
easy to understand, usually through charts and graphs. On the other hand,
data storytelling is more concerned with using data to tell a story that will
engage the audience and help them understand the problem. In addition, data
storytelling often uses narratives to explain the data, while data visualization
focuses on presenting the data itself. Anyway, good data storytelling includes
visualization elements.

Data storytelling helps analysts to communicate their findings in a way that is


both engaging and informative while also helping the audience understand a
problem in a new way and see the potential solutions more clearly.

Having covered the questions of when to use data storytelling, what problems
it can solve, and what makes it unique, we're now ready to consider questions
relating to our two tools: Python Altair and Generative AI tools. We will do
that in the next section.

1.1.4 What are the challenges of data storytelling?


Crafting compelling data stories is no easy feat. It demands both time and
financial investment to ensure engaging narratives packed with valuable
information. Moreover, it involves bringing together individuals from diverse
backgrounds, each with their own expertise and perspectives, to work
collaboratively. This collaboration can be challenging, but it's essential for
weaving together a cohesive and impactful data story.

The challenges of creating data stories involve two key factors: time and
teamwork. Investing in these areas is crucial to captivate audiences and
effectively communicate insights.

1.2 Why Should You Use Python Altair and


Generative AI for Data Storytelling?
Python provides you with many libraries for data visualization. Many of
them, including Matplotlib and Seaborn, are imperative libraries, meaning
you must define exactly how you want to build a visualization. Python Altair,
instead, is a declarative library where you specify only what to visualize.
Using Python Altair for data storytelling instead of other imperative libraries
lets you quickly build your visualizations.

For example, to plot a line chart using Matplotlib, you must specify explicitly
the x and y coordinates, set the plot title, labels, and customize the
appearance, as shown in Listing 1.1.

Listing 1.1 Imperative library

import matplotlib.pyplot as plt


x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]

plt.plot(x, y)
plt.title('Square Numbers')
plt.xlabel('X')
plt.ylabel('Y')

plt.show()

An example of an imperative library

The chart builds a line chart in Matplotlib. You must define the single steps
to build the chart: 1) set the title, 2) set the x-axis, 3) set the y-axis.

Instead, declarative visualization libraries, like Altair, enable you to define


the desired outcome without specifying the exact steps to achieve it. For
instance, using Altair, you can simply define the data, x and y variables, and
let the library handle the rest, including axes, labels, and styling, resulting in
a more concise and intuitive code (Listing 1.2).

Listing 1.2 Imperative library

import altair as alt


import pandas as pd

df = pd.DataFrame({'x': [1, 2, 3, 4, 5], 'y': [1, 4, 9, 16, 25]})

chart = alt.Chart(df).mark_line().encode(
x='x',
y='y'
).properties(
title='Square Numbers'
)

An example of a declarative library

The chart builds a line chart in Altair. You must define the chart type
(mark_line), the variables, and the title.

Generative AI is a subset of artificial intelligence techniques involving


creating new, original content based on patterns and examples from existing
data. It enables computers to generate realistic and meaningful outputs, such
as text, images, or even code. In this book, we will focus on ChatGPT to
generate text, DALL-E to generate images, and GitHub Copilot, to assist you
while coding.

ChatGPT is an advanced language model developed by OpenAI.


Powered by the GPT-3.5 architecture, it is designed to engage in human-
like conversations and provide intelligent responses.
DALL-E is a generative AI model created by OpenAI. It combines the
power of GPT-3 with image generation capabilities, allowing it to create
unique and realistic images from textual descriptions.
GitHub Copilot is a recent tool powered by OpenAI Codex, assisting
you while writing your code. In GitHub Copilot, you describe the
sequence of actions that your software must run, and GitHub Copilot
transforms it into a runnable code in your preferred programming
language. The ability to use GitHub Copilot consists in learning how to
describe the sequence of actions.

Combining Python Altair and Generative AI tools will enable you to write
compelling data stories more quickly directly in Python. For example, we can
use Copilot to assist us in generating the necessary code snippets, such as
importing the required libraries, setting up the plot, and labeling the axes. In
addition, Copilot's contextual understanding helps it propose relevant
customization options, such as adding a legend or changing the color scheme,
saving us time and effort in searching for documentation or examples.

While generative AI tools are still at their early stages, some promising
statistics reveal they increase workers' productivity. A study by Duolingo,
one of the largest language learning apps, reveals that the use of Copilot in
their company has increased developers’ speed of 25% (Duolingo and
GitHub Enterprise 2022). Compass UOL, a digital media and technology
company, run another study by asking experienced developers to measure the
time it took to complete the use-case task (analysis, design, implementation,
testing, and deployment) during three distinct periods: before AI, utilizing AI
tools available until 2022, and employing new generative AI tools such as
ChatGPT (Compass UOL 2023). Results demonstrated that developers
completed the tasks in 78 hours before AI; 56 hours with the AI used through
2022, and 36 hours with the new Generative AI. Compared to the Pre-AI era,
there is an increase in speed of 53.85% with the new Generative AI (Figure
1.4).

Figure 1.4 The results of the tests conducted by Compass UOL

1.2.1 The Benefits of Using Python in All the Steps of the Data
Science Project Life Cycle
Many data scientists and analysts use Python to analyze their data. Thus it
should be natural to build the final report on the analyzed data still in Python.
However, data scientists and analysts often use Python only during the
central phases of the data science project life cycle. Then they move to other
tools, such as Tableau and Power BI, to build the final report, as shown in
Figure 1.5. This means adding other work, which includes exporting data
from Python and importing them into the external application. This
export/import operation in itself is not expensive, but if, while building the
report, you realize that you have made a mistake, you need to modify the data
in Python and then export the data again. If this process is repeated many
times, there is a risk of significantly increasing the overhead until it becomes
unmanageable.

Figure 1.5 In the traditional approach, data scientists use different technologies during the phases
of the data science project life cycle

This book enables data scientists and analysts to run each step of the data
science project life cycle in Python, filling the gap of exporting data to an
external tool or framework in the last phase of the project life cycle, as shown
in Figure 1.6.

Figure 1.6 In the approach proposed in this book, data scientists use the same technology during
all the phases of the data science project life cycle
The advantage of using Python Altair and Generative AI for data storytelling
is that programmers can build their reports even during the intermediate
stages of their experiments without wasting time transferring data to other
tools such as Tableau or Power BI.

1.2.2 The Benefits of Using Generative AI for Data Storytelling


In general, you can use Generative AI as an aid throughout all the life cycle
of a data science project. However, in this book, we will focus only on
generative AI in the data presentation phase, which corresponds to the data
storytelling phase.

The introduction of Generative AI tools to aid the data presentation phase


allows you to devote the same effort and time as you did without to the data
presentation phase, obtaining better results. Thanks to Generative AI tools,
you can make the audience understand your data (Figure 1.7).

Figure 1.7 Introducing Generative AI in the data presentation phase helps you to build better
charts in less time, enabling the audience to understand your message

Having discussed the benefits of the tools of choice in this book, we should
also briefly discuss contexts in which these tools are not as effective.

1.3 When Altair and Generative AI Tools are Not


Useful for Data Storytelling
While Python Altair and Generative AI tools are handy for building data
stories very quickly, they are not useful when analyzing big data, such as
gigabytes of data. You should not use them if you want to:

Do complex exploratory data analysis: exploratory data analysis helps


data analysts summarize a dataset's main features, identify relationships
between variables, and detect outliers. This approach is often used when
working with large datasets or datasets with many variables.
Do big data analytics: big data analytics analyzes large datasets to
uncover patterns and trends. To be effective, big data analytics requires
access to large amounts of data, powerful computers for processing that
data, and specialized software for analyzing it.
Write complex reports that summarize big data.

Altair enables you to build charts with datasets with 5,000 rows at maximum
quickly. If the number of rows exceeds 5,000, Altair still builds the chart, but
it’s slower.

For complex data analytics, use more sophisticated analytics platforms, such
as Tableau and Power BI.

In addition, consider that you should pay a fee to use Generative AI tools, so
do not use them if you do not have a sufficient budget.

1.4 Using the DIKW Pyramid for Data Storytelling


The primary focus of this book revolves around a significant concept known
as Data Information Knowledge Wisdom (DIKW) pyramid (Figure 1.8),
which we believe gives data scientists and analysts the macro steps to build
data stories. We’ll cover the DIKW pyramid more extensively in Chapter 5,
Crafting a Data Story through the DIKW Pyramid. Here, we introduce it
because it is fundamental to understand how we can use it to build data
stories.

The DIKW pyramid provides macro steps to transform data into knowledge,
following other intermediate steps, which include information and
knowledge.
Figure 1.8 The DIKW pyramid

The DIKW pyramid comprises the following elements:

Data is the building block at the bottom of the pyramid. Usually, we


start from a significant amount of data, more or less cleaned
Information involves extracting meaning from data. The information
represents organized and processed data that are easy to understand.
Knowledge is information interpreted and understood through a context
that defines the data background
Wisdom is the knowledge enriched with specific ethics that invites you
to act in some way. Wisdom also proposes the next steps to follow after
we have understood the data.

This book describes how to use the elements of the DIKW pyramid as
progressive steps to transform your data into compelling data stories. This
idea is not new in data storytelling; Berengueres et al. proposed this approach
(Berengueres 2019). The novelty of this book is the combination of the use of
the DIKW pyramid, Python Altair, and Generative AI. In this section, we will
introduce the fundamentals of DIKW that will be applied throughout this
book, and we’ll see how to climb each level of the pyramid.”

1.4.1 From Data to Information


To turn data into information, extract meaning from data. Consider the
following scenario:

The organizers of an event dedicated to pets are collecting the type of pets
that will participate. For each pet category, the organizers advertise the event
on specific websites dedicated to that category. The organizers ask you to
build a quick report about the current situation. The following table shows the
number of participants and the number of advertised websites divided by
type.

Table 1.1 Data related to pets involved in the event

Pet Number of participants Number of advertised websites

Cat 1138 150

Dog 130 28

Other 17 147

First, you focus on the number of participants. and build the following bar
chart.

Figure 1.9 A bar chart showing the number of pets participating in the event
With respect to Table 1.1, Figure 1.9 does not add any meaning. It’s simply a
visual representation of the table. For some aspects, the table is even clearer
than the bar chart.

To turn data into information, start understanding data. Ask the following
questions:

Who is the audience of my story?


What information do they want?
Are all the data relevant to answer the previous questions?

Let’s answer those questions. The organizers of the event are the audience for
our story. They want to know the current situation of animals involved in the
event. We could suppose that they want to elaborate a promotion plan to
increase the number of pets participating in the event.

Looking at the raw data in the table, you notice that the cat category has the
highest number of participants by some margin, followed by a relatively low
number of dogs. It seems that owners of other pets, judging by the almost
total lack of participants, are not interested in the event.
You may focus on one of the following options:

Remove the Other category because it is irrelevant


Focus on the Other category and propose a strategy to increase their
participation.

Let’s focus on the first possible course of action, removing the Other
category. Now, calculate the percentage of participants for each category, as
shown in the following table:

Table 1.2 Data related to pets involved in the event, with a focus on the percentage of the number
of participants

Pet Number of participants Percentage

Cat 1138 88.56

Dog 130 10.12

Notice that 88.56% of pets are cats and 10.12% are dogs. Usually, the final
audience may not be interested in the details of numbers, so approximate cats
at 90% and dogs at 10%. The extracted information is that one pet out of 10
is a dog, and 9 out of 10 is a cat. This is the meaning of your data.

Consider the following stacked bar chart describing the situation.

Figure 1.10 A stacked bar chart showing the current percentage of pets participating in the event
The figure is self-explanatory because the audience can understand the
situation immediately. You have extracted information (and thus, meaning)
from the data.

1.4.2 From Information to Knowledge


To turn information into knowledge, add context. Context involves all
circumstances around data, such as events, situations, etc. Adding context
helps the audience to understand data better.

Consider the previous example of dogs and cats. You already know that the
percentage of cats is greater than that of dogs. For example, adding context
means describing the events and situations in which motivated dog owners do
not participate. Let’s focus on the third column of the dataset described back
in Table 1.1, and which is recalled in Table 1.3: the number of advertised
websites. The number of advertised websites for cats is 150, and for dogs, 28.
This information is the context because it helps the audience to understand
why the number of cats is higher than the number of dogs.

Calculate the ratio between the number of participants and the number of
advertised websites to understand the participant's rate. Table 1.3 shows the
calculated values.

Table 1.3 Data related to pets involved in the event, with a focus on the participant's rate

Participant’s
rate
Number of Number of advertised
Pet participants Percentage websites #participants

#websites

Cat 1138 88.56 150 7.59

Dog 130 10.12 28 4.64

Cat’s participant rate is 7.59, meaning almost 8. Dog’s participation rate is


4.64, meaning almost 5. The participant rate helps the audience to understand
the context related to the number of participants in the event.

The following figure shows the stacked bar chart of Figure 1.10 enriched
with context.

Figure 1.11 A stacked bar chart showing the current percentage of pets participating in the event,
enriched with context

The context involves the following elements:

The title, which summarizes the chart content


The header, which describes the number of advertised websites
Two images, one for cats and the other for dogs, to facilitate reading.
The content described by the chart in Figure 1.6 is easier to read and
understand than that shown in the chart in Figure 1.4.

Adding context to the chart has enabled us to turn information into


knowledge.

1.4.3 From Knowledge to Wisdom


Turning knowledge into wisdom means adding a call to action, which invites
the audience to do something with the discovered knowledge.

A call to action is a very effective way to help drive conversions. Here are
some examples:

What changes can we make?


What opportunities do we have?
What advantages does our program offer?
What scenarios can we outline?
What are some examples of scenarios?

Alternatively, you may propose a possible solution to the questions or you


may invite the audience to discuss and listen to their proposals and answers to
our questions. It's here where the discussion takes place.

Your audience often needs the opportunity to voice their opinion and make
suggestions. Sometimes they may even have one or more questions.

Consider again the cats and dogs example. To add a call to action, change the
title from 9 pets out of 10 are cats to Increase the advertising campaign on
dog-related websites! Figure 1.12 shows the resulting chart, which adds the
call to action in the title.

Figure 1.12 A stacked bar chart showing the current percentage of pets participating in the event,
enriched with a call to action
The pets’ scenario demonstrated how to turn data into wisdom. Firstly, we
took data that contained the raw number of participants in the event. Then,
we extracted information that told us that 1 participant out of 10 is a dog and
the remaining 9 are cats. Next, we added a context that explained why dogs
were not interested in the event. The motivation was that the advertising
campaign for dogs was poor. Finally, we added a call to action that invited
the audience to increase the dog advertising campaign.

In this chapter, you have learned the basic concepts behind data storytelling
and how to transform data into stories using the DIKW pyramid. In the next
chapter, you’ll see how to use Python Altair and Generative AI to implement
the DIKW pyramid approach.

1.5 Summary
Data storytelling is a powerful tool that helps you communicate your
data more effectively. Data storytelling makes complex data more
relatable and easier to understand when used correctly.
Python Altair and Generative AI are great tools for creating stunning
data stories.
Do complex exploratory data analysis: exploratory data analysis helps
data analysts summarize a dataset's main features, identify relationships
between variables, and detect outliers. This approach is often used when
working with large datasets or datasets with many variables.
Don’t use Python Altair and Generative AI if you want to perform big
data analytics or write complex reports that summarize big data.
Use the DIKW pyramid to turn your data into wisdom.
1.6 References
Berengueres, J. and Sandell, M. (2019) Introduction to Data Visualization &
Storytelling: A Guide For The Data Scientist. Independently published.

Cairo, A. (2012). The Functional Art. New Riders.

Compass UOL (2023). Generative AI Speeds Up Software Development:


Compass UOL Study. https://blog.compass.uol/noticias/generative-ai-speeds-
up-software-development-compass-uol-study/ (Last Access, 2023/05/16)

Duolingo and GitHub Enterprise (2022). Duolingo empowers its engineers to


be force multipliers for expertise with GitHub Copilot,
Codespaces.https://github.com/customer-stories/duolingo (Last Access,
2023/05/16)

Dykes, B. (2023). LinkedIn post:


https://www.linkedin.com/feed/update/urn:li:activity:7061798908565336065/
(Last Access, 2023/05/10)
2 Running your first data story in
Altair and GitHub Copilot
This chapter covers
Introduction to Altair
Prerequisites
Use Case: Describing the Scenario
First Approach: Using Altair
Second Approach: Using Copilot

In this chapter, we will look at the basic concepts behind Altair, and then we
will implement a practical use case, which will allow us to transform a raw
dataset into a story. We will progressively apply the Data, Information,
Knowledge, Wisdom (DIKW) pyramid principles in Altair and see the results
achieved step by step. In the second part of the chapter, we will use Copilot
to automate some steps of the story creation process. We will focus only on
Copilot as a Generative-AI tool to keep the chapter simple and the flow
understandable. In the next chapters, we will introduce ChatGPT and DALL-
E to the DIKW pyramid.

2.1 Introduction to Altair


The Vega-Altair library (Altair, for short) is a declarative Python library for
statistical visualization based on the Vega and Vega-Lite visualization
grammars. Vega is a visualization grammar for creating expressive and
interactive data visualizations. Vega-Lite is a high-level declarative language
built on top of Vega, designed to simplify the creation of common data
visualizations with concise and intuitive syntax. We will discuss Vega and
Vega-lite in the next chapter.

Altair is a declarative library because you can describe the intended chart
outcome rather than manually programming every step, defining a concise
and intuitive syntax for creating interactive visualizations. We use declarative
libraries to specify what we want to see in a chart. We can specify the data
and the type of visualization we want, and the library creates the visualization
for us automatically. Declarative libraries stand in contrast to imperative
libraries, which instead focus on building a visualization manually, for
example specifying the desired axis, size, legend, and labels. Matplotlib is an
example of an imperative library.

Every Altair chart has at least three main elements: Chart, mark, and
encodings. We will cover each of these briefly in the following pages. Refer
to Appendix A to install Altair and the other Python libraries described in this
chapter. Refer to Appendix B for more details on the Pandas DataFrame
methods used in this chapter.

2.1.1 Chart
A Chart in Altair is an object acting as a starting point for constructing and
customizing interactive visualizations in Altair.. Use it to input the dataset
you would like to represent visually:

Listing 2.1 Chart in Altair

import altair as alt


import pandas as pd

# Create data for the DataFrame


data = {'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [25, 30, 35],
'City': ['New York', 'Paris', 'London']
}

# Create the DataFrame from the data


df = pd.DataFrame(data)

# Print the dataframe


print(df)

# Create the chart


chart = alt.Chart(df)

Chart
First, import the required libraries, then build the DataFrame containing your
data. Finally, pass the DataFrame to, alt.Chart(). The example does not
create any visualization yet because we have not specified what we want to
represent.

2.1.2 Mark
A mark defines how to represent data. Examples of marks include bar charts,
line charts, area charts, and many more. To specify a mark, append it to the
Altair Chart. For example, in the listing below, we will specify that we want
to use a bar chart.

Listing 2.2 Mark in Altair

chart = alt.Chart(df).mark_bar()

Mark

Use mark_bar() to create a bar chartin Altair. If we run the code as it is, it
raises the following remarks: 1. from config import * 2.
configure_layout(chart) is required to display the diagram 3. This is because
we have not defined which dataset columns we want to represent.

Each mark is mark_<type_of_graph>(). Examples of marks are:

mark_bar() to plot a bar chart (Figure 2.1)

Figure 2.1 An example of a bar chart


mark_line() to plot a line chart (Figure 2.2)

Figure 2.2 An example of a line chart

mark_circle() to plot a scatter plot (Figure 2.3).

Figure 2.3 An example of a scatter plot

2.1.3 Encodings
Encodings specify the mapping between the DataFrame columns and their
visual representation in the Altair chart. In practice, encodings define where
to represent data in the chart, such as their position, size, and color. We call
channel every visual representation of data in the chart. Examples of channels
are axes, color, size, and so on. For example, in the listing below, we use
encodings to specify which columns of the DataFrame we must use in the x
and y axes:
Listing 2.3 Encodings in Altair

import pandas as pd
import altair as alt

# Create data for the DataFrame


data = {'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [25, 30, 35],
'City': ['New York', 'Paris', 'London']
}

# Create the DataFrame from the data


df = pd.DataFrame(data)

# Create the chart


chart = alt.Chart(df).mark_bar(
).encode(
x = 'Age:Q',
y = 'Name:N'
)

chart.save('chart.html')

Encodings

Use encode() to define encodings in Altair. Place the Age variable of df on


the x-axis and the Name variable of df on the y-axis. Interpret Age as a
quantity (Q), and Name as a nominal value (N). Use
chart.save('chart.html') to export the chart as an HTML file. If you use a
Jupyter notebook, use chart.display() to plot the chart inline.

Figure 2.4 shows the chart produced by the code contained in Listing 2.3.

Figure 2.4 The chart produced by Listing 2.3

You can practice with basic charts in Altair through the examples provided in
the GitHub repository of the book. Start by cloning the GitHub repository of
the book, available at the following link: https://github.com/alod83/Data-
Storytelling-with-Python-Altair-and-Generative-AI[1]. To get started with
GitHub, follow the procedure described in Appendix A of the book or the
GitHub official documentation. Find the examples under 02/Basic
Chart.ipynb of the GitHub repository.

Now that you have learned the basic concepts behind Altair, we will review
the prerequisites for implementing a practical scenario in Altair and Copilot.

2.2 Use Case: Describing the Scenario


Let us suppose we are at the end of 2019, before the Covid-19 pandemic.
You work as a data analyst at a Portuguese hotel. Your boss has experienced
increased tourist arrivals in their hotel and wants to invest money to build a
new swimming pool. Before investing money, they ask you to study the
phenomenon to understand whether their investment will be successful. The
objective of your task is to see whether Portugal is seeing an increased
number of tourist arrivals in recent years relative to global trends.

You start your searches and find a dataset about arrivals at tourist
accommodation establishments[2], released as open data by Eurostat. For
simplicity, in this chapter, you consider only one dataset, but in a real use-
case scenario, you should consider more data, including the popularity of
swimming pools among tourists visiting Portugal, the cost of building a new
swimming pool at the hotel, and the potential revenue that the new swimming
pool could generate for the hotel.

The dataset contains the number of arrivals at tourist accommodation


establishments since 2019 in all European countries. For simplicity, focus
only on the following countries: Portugal, France, Italy, Germany, Spain, and
the United Kingdom.

Find the code described in this chapter in folder 02 of the GitHub repository
and the dataset in folder 02/source of the same repository.

2.2.1 The Dataset


Table 2.1 shows a sample of the dataset we will analyze. The dataset contains
the tourist arrivals at establishments from 1994 to 2019 for Italy (IT), France
(FR), Germany (DE), Portugal (PT), Spain (ES), and the United Kingdom
(UK).

Table 2.1 Arrivals at tourist arrivals establishments since 1994

Date IT FR DE PT ES UK

1990-
2.543.920 3.185.877 325.138 1723786 1.776.000
01-01

1990-
2.871.632 3.588.879 381.539 1885718 2.250.000
02-01

1990-
3.774.702 4.272.437 493.957 2337847 2.662.000
03-01

… … … … … … …

2019-
11.649.500 13.692.822 14.570.339 2.531.809 12893366 8.889.049
08-01

2019-
9.888.817 11.684.845 14.373.815 2.263.748 5.858.984
09-01

2019-
7.692.388 10.401.793 13.780.441 1.995.942 7.455.781
10-01
The table contains some missing values for some countries. Load the dataset
as a Pandas DataFrame:

Listing 2.4 Loading the dataset as a Pandas DataFrame

import pandas as pd

df = pd.read_csv('source/tourist_arrivals_countries.csv', parse_dates=['Date

Dataset loading

Use Pandas to load the dataset as a DataFrame. Use the parse_dates


parameter to load the Date field as a date.

Now, you are ready to perform basic data exploration.

2.2.2 Data Exploration


Exploratory Data Analysis (EDA) aims at analyzing and visualizing data to
extract insights and understanding of its underlying patterns, distributions,
and relationships. You may even use Generative AI to perform EDA.
Performing a complete data exploration is out of the scope of this book.
However, for quick data exploration, you can use an existing library, such as
ydata profiling[3] or Sweetviz[4]. In this chapter, we’ll use ydata-profiling.
Import the library, create a ProfileReport() object, and pass the Pandas
DataFrame as an input argument. Finally, build the report by invoking the
to_file() method:

Listing 2.5 Building a summary report

from ydata_profiling import ProfileReport

eda = ProfileReport(df)
eda.to_file(output_file='eda.html')

Dataset exploration

Use pandas-profiling to build a summary report of the dataset.


As a result, the to_file() method produces an HTML file that contains the
report. The following figure shows a snapshot of the produced report.

Figure 2.5 A snapshot of the report produced by pandas-profiling


The report contains many sections, as shown in the top right menu of Figure
2.5. The report may help you to

Understand the data: the report provides an overview of the dataset,


including the number of observations, variables, and missing values.
Use this information to understand the data quality.
Identify data types: the report identifies the data types of each variable
and provides a summary of their distribution, including measures such
as mean, median, standard deviation, and range. Use this information to
identify variables that may require further preprocessing.
Identify correlations: the report provides a correlation matrix, heatmap,
and scatter plot matrix, which can help identify variables that are highly
correlated or related.
Identify distributions: The report provides distribution plots, including
histograms and density plots, which can help identify the shape and
spread of the distribution of each variable. Use this information to
understand the underlying patterns and trends in the data.

In our case, the missing value section describes the presence of missing
values for some countries (France, Spain, and the United Kingdom), as
shown in the following figure:

Figure 2.6 The report highlights missing values for France, Spain, and the United Kingdom
Now that we have quickly explored the dataset, you are ready to build a data
story from that dataset. Let’s start with the first approach: using Altair.

2.3 First Approach: Altair


To transform data into a story, we will proceed step by step. First, we’ll build
a basic chart and then gradually enrich it with the elements necessary to
transform the chart into a story in its own right. We’ll use the principles of
the DIKW pyramid to implement this progressive enrichment:

From data to information


From information to knowledge
From knowledge to wisdom

Let’s start with the first step of the DIKW pyramid, turning data into
information.

2.3.1 From Data to Information


Turning data into information means extracting some meaning from data.
Start by drawing the raw chart, shown in the following code:

Listing 2.6 Building the raw chart in Altair

import altair as alt

df2 = pd.melt(df, id_vars='Date', value_name='Tourist Arrivals', var_name='C

chart = alt.Chart(df2).mark_line().encode(
x = 'Date:T', #A
y = 'Tourist Arrivals:Q', #B
color=alt.Color('Country:N') #C
)

chart.save(‘chart.html)

The raw chart in Altair


Use the mark_line() property to build the raw chart in Altair. Draw the
number of tourist arrivals on the y-axis and the date on the x-axis.

Use the melt() function to unpivot the dataset, i.e., transform data rows into
columns. Then, build the chart. The chart uses three channels: x and y, to
describe the axes, and color, to group by countries. For each channel, specify
the column in the dataset (for example, Date for the x channel) and the data
type (T for temporal data, Q for quantitative data, and N for nominal data). The
following figure shows the produced chart:

Figure 2.7 The raw chart produced in Altair without any manipulation

The chart is difficult to read because all countries overlap. However, we can
extract the following highlight: all the trend lines have increased since 1990.
This is a positive message to communicate to our boss. From 1990 until
2019, there has been a progressive increase in the arrival of tourists. Let's
focus more on this information.

In all cases, we are not interested in knowing the intermediate data, as there
are no outliers, only the starting point (1990) and the final point of the time
series (2019). However, we note that for some countries, there is no data for
1990, and 2019 is incomplete (the data goes up to October). In this case, the
question is: what to do in the presence of missing values? The answer is: it
depends. In our case, we are dealing with a time series that grows
progressively (seasonality excluded), so we can restrict the analysis range
only to the dates for which we have data. Thus, we narrow our search to the
range 1994-2018.

Let’s implement this strategy in Altair.

Start by removing missing values from the dataset:

Listing 2.7 Removing missing values from the dataset

mask_fr = df['FR'].isnull() == False


mask_uk = df['UK'].isnull() == False
mask_es = df['ES'].isnull() == False
df = df[(mask_fr) & (mask_uk) & (mask_es)]

Removing missing values

Use the isnull() method to build a mask that selects missing values. Then
use the mask to filter missing values in the original dataset.

Then, group data by year and calculate the average value. Also, select only
data for 1994 (the first in the dataset) and 2018 (the penultimate in the
dataset).

Listing 2.8 Grouping by year and calculating the average value

df2 = df.copy()
df2.loc[:, 'Year'] = df['Date'].dt.year

df2 = df.groupby(by='Year').mean(numeric_only=True)
df2 = df2.iloc[[0, -2]]
df2.reset_index(inplace=True)

Extracting the first and the last year from the dataset

First, extract the year from the Date field, then group data by year and
calculate the average value. Next, select only the first year (1994) and the
penultimate year (2018). Finally, reset the index to retrieve the year.

Use loc to access a group of rows and columns by labels and iloc to access
group rows and columns by numerical indices. Use the reset_index()
function to create a new index column starting from 0 and move the current
index values to a new column.

Finally, build the chart in Altair:

Listing 2.9 Building the chart in Altair

df3 = pd.melt(df2, id_vars='Year',value_name='Tourist Arrivals', var_name='C

chart = alt.Chart(df3).mark_line(point=alt.OverlayMarkDef()).encode(
x = alt.X('Year:O', title='', axis=alt.Axis(labelAngle=0)), #A
y = 'Tourist Arrivals:Q',
color=alt.Color('Country:N')
).properties(
width=400,
height=300,
title='Countries Trend in Arrivals'
)

chart.save(‘chart.html’)

Building a line chart in Altair

Use the mark_line() property to build a line a chart in Altair. Pass


point=alt.OverlayMarkDef()to highlight points for each line. Configure the
label angle for the x channelwith axis=alt.Axis(labelAngle=0). Finally,
set the chart width, height, and title through the width, height and title
properties of the properties() function..

To encode the x channel, we have used the alt.X() object and not a simple
string as we did for the other channels. When we want to specify the channel
details, we can use the channel object instead of a simple string. For example,
we can use alt.Y() to set the properties of the y channel, alt.Color() for
the color channel, and so on. Within a channel object, you can set different
properties that depend on the channel. For example, for the x and y channels,
you can set the axis property. For each property within a channel, you can
define a value or an additional object. In practice, the same strategy of
channels applies to the channel properties. For example, axis is a property of
the x and y channels. We can use alt.Axis() to set additional properties of
the axis. In the example, we have set the labelAngle property of the axis.

To build the chart, we have also used the properties() function, which
configures the chart's general properties, such as the width, the height, and
the title.

The following figure shows the produced chart:

Figure 2.8 The produced chart after calculating the average value for each year and removing
intermediate years

The chart is clearer than that in Figure 2.7: you can easily distinguish the
trendline for each country. However, the presence of too many colors and
countries does not transmit the message. Our objective is to focus on
Portugal, which is the country about which our boss has asked for
information. In addition, we calculate the average number of tourist arrivals
to the other countriesfor comparison. The following listing describes how to
prepare the DataFrame for the chart:
Listing 2.10 Preparing the DataFrame

mask = df3['Country'] == 'PT' #A


df4 = df3.loc[~mask].groupby('Year').mean().reset_index() #B
df4['Country'] = 'Others (mean)' #C
df5 = df3.loc[mask].append(df4, ignore_index=True) #D

Prepare the DataFrame

Build a new DataFrame with two countries: Portugal and the average value
for the other countries.

Table 2.2 shows the resulting DataFrame.

Table 2.2 Arrivals at tourist arrivals establishments since 1994

Year Country Tourist Arrivals

1994 PT 563,354.83

2018 PT 1703,339.0

1994 Others (mean) 4,503,850.8

2018 Others (mean) 9,082,776.1

Now we can draw the chart, as shown in the following listing:

Listing 2.11 Drawing the chart with Portugal and Average

chart = alt.Chart(df5).mark_line(point=alt.OverlayMarkDef()).encode(
x = alt.X('Year:O', title='', axis=alt.Axis(labelAngle=0)),
y = 'Tourist Arrivals:Q',
color=alt.Color('Country:N')
).properties(
width=400,
height=300,
title='Countries Trend in Arrivals'
)
chart.save('chart.html')

Draw the chart

Use df5 to draw the new chart.

The following figure shows the resulting chart after selecting only Portugal
and the average value for the other countries.

Figure 2.9 The produced chart after selecting only Portugal and Germany

The increase in the number of tourists over time in the other countriesis
greater than that of Portugal. However, we are not interested in knowing the
absolute values, but rather the percentage increase of each country over time.
If we use absolute values, instead, we can’t answer the following questions
immediately:
For each country, what is the percentage increase since 1994?
Which of the two nations experiences the greater percentage increase?

If we use the percentage increases, we can put the two countries on a more
comparable level and we can answer the previous questions. Let’s calculate
the percentage increase since 1994 for each country and then plot the chart of
percentage increases instead of that of absolute values.

Calculate the percentage increase using the following formula:

Percentage Increase = (Final Value - Starting Value) / Starting Value * 100

In our case, calculate the percentage increase for each country as follows:

Listing 2.12 Calculating the percentage increase for each country

mask_first = df5['Year'] == 1994


mask_last = df5['Year'] == 2018
mask_pt = df5['Country'] == 'PT'
mask_ot = df5['Country'] == 'Others (mean)'

pi_pt = (df5[mask_last & mask_pt]['Tourist Arrivals'].values[0] - \


df5[mask_first & mask_pt]['Tourist Arrivals'].values[0]) / \
df5[mask_first & mask_pt]['Tourist Arrivals'].values[0]*100

pi_ot = (df5[mask_last & mask_ot]['Tourist Arrivals'].values[0] - \


df5[mask_first & mask_ot]['Tourist Arrivals'].values[0]) / \
df5[mask_first & mask_ot]['Tourist Arrivals'].values[0]*100

Percentage increase

First, build two masks, one for each year and for each country. Then calculate
the percentage increase for each country. Use df[field].values[0] to get
the value of the first row of a field.

Now, build again the chart, as shown below:

Listing 2.13 Drawing the chart of percentage increases

df_pi = pd.DataFrame({
'Date' : [1994,2018,1994,2018],
Discovering Diverse Content Through
Random Scribd Documents
“Don’t you hear something?” she said, “come in, come in, don’t lose a
minute. What if he should lock the kitchen door? Harry, promise me you’ll
not stop to say a word, but run up to your bed.”
She was hurrying while she spoke, through the series of outbuildings,
dragging him with her, breathless, and speaking in gasps. But as they went
on from one to another there could be no longer any doubt as to what had
happened. The kitchen door, which opened from these offices, was shut
with a loud jar, and the key turned.
“I dunno’ who’s out and about at this hour of the night,” Joscelyn was
heard within, “but whoever it is they’ll stay there: some o’ the women out
like the cats, dash them, or may be a good-for-nothing lad. I’ll teach them
what it is to roam the country o’ nights. You’ll stay there whoever you are.”
Joan lost all her self-command in the emergency. She dropped Harry’s
hand and threw herself against the door.
“Oh, father, father, open! do you hear me? It’s me, Joan. Open! will you
let me bide out in the cold, in the dead of night? Father! let me in, let me in!
you wouldn’t have the heart to shut me out all night. It’s me, me, Joan!”
There was no reply; his steps were heard going away mounting the
stairs, and a faint outcry in the distance as of the mother weeping and
protesting. Joan, who was a very simple person, though so self-commanded
in emergencies which her mother could not face, was altogether taken by
surprise by this. She flung herself against the door with a burst of weeping.
“Oh, open, open!” she said, beating upon it with her hands. Then she
called out the names of the servants one after another. “I’ll not be left here
all the night; open, open! do you hear! I’ll not be left here all the night. I’ll
die if I am left out in the dark. I’ll not be left!” she cried with a shriek.
Harry was silenced by this loud and sudden passion so close to him. It
alarmed him, for Joan was the impersonation of strength and calm; but the
situation was uncomfortable enough, however it could be taken. The
consciousness that he had some one else to think for, some one who for the
present had lost her head, and all power to think for herself, changed his
own position. He caught his sister by the arm.
“Don’t make such a row,” he said, “Joan, you! that was always against a
fuss.”
“Oh,” cried Joan half wild, “did I ever think that I’d be shut out like a
bad woman out of the house at the dead of night—me! that was always the
most respectable, that never stirred a step even in the evening times, or said
a word to a man. Open! it isn’t the cold, it’s the character: me! me!”
But all her beating and knocking, and all her prayers were in vain. The
maids slept soundly, all but one trembling girl who heard the voice without
knowing whose it was, and dared not get up to see what was the matter,
especially as she heard mysterious steps going up and down stairs. And the
mistress of the house sobbed in her chamber in the dark, wringing her
hands. She had come almost to the length of personal conflict with her
husband for the first time in her life; but poor Mrs. Joscelyn even in her
despair was no sort of match for the man who lifted her, swearing and
laughing, into her bed, and locked the door upon her when he went
downstairs. He came up and fiercely ordered her to be silent.
“Dash you, hold your blanked tongue. I’ve taken it into my own hands,
and if you venture to interfere I’ll pitch you out of window as soon as look
at you,” he said, “a deal sooner for that matter—for you’re not tempting to
look at, you dashed white-faced ——”
“Yes, do,” she cried, “throw me out of the window, throw me out to my
children. I’d rather be dead with my children than living here.” And she
rushed to the window and threw it open; but he caught her before she could
throw herself out, and perhaps, poor woman, she would not have thrown
herself out; for “I dare not” very often waits upon “I would” in such
circumstances. He carried her back crying and struggling to her bed.
Though he had not hesitated to turn the key upon his son and daughter, he
had no desire to have it whispered in the country side that his wife had
thrown herself out of window, because of his cruelty; but he could not resist
giving her a shake as he threw her upon her bed.
“I’d never have had any fuss in my family if it hadn’t been for you; just
you budge at your peril,” he said, threatening her with his fist. And there
she lay with the cry of her daughter in her ears, and the sound of the
knocking that seemed to be upon her heart. To tell the truth she was not
very anxious about Joan. Joan would have a bad cold, that would be all the
damage she would take; but Harry, Harry! what would Harry do?
When Joan had beat the door and her knuckles almost to a jelly, she
came to a sudden pause. In a moment her mood changed; her passion
wrought itself out almost as suddenly as it began.
“Well, if I can’t have the door opened I’d best give up trying,” she said
all at once. Her hands were fatigued with knocking, and her feet with
kicking. She was hoarse, and her eyes ached with the hot tears that had
poured from them. She came to herself with a sudden sense of shame—she
who was so strenuous in her opposition to a fuss. She had no sense of cold
now, her shawl hung off her shoulders with the fervour of her efforts. “My
word, but I’ll give it to those lasses,” was the next thing Joan said: and then
she laughed at herself to carry off her sense of shame.
“We’re both in the same box, Harry,” she said, “well! two together isn’t
so bad as one alone; come back to the washhouse. I’m glad I told them to
light that copper—if it wasn’t a providence! we’ll sit us down there and
keep warm; and don’t you take on, my lad. It’s not so very long to day.”
When she recovered, however, it was Harry’s turn. He followed her back
to the copper without a word. He even pulled the bench on which the tubs
stood close to that centre of warmth for her, and got her something on
which to put her feet. By this time a certain pleasure in the novelty of the
situation had arisen in Joan’s mind. “My word, I made a fine noise. Mother
will be in a terrible way, that’s the worst of it. As for father I’ll pay him out.
Don’t you be afraid; he’ll repent the night he meddled with Joan; and I’ll
give it to the maids. Just as likely as not he’s taken away the key; but bless
us all, what’s the good of being a woman if you can’t find out a way? I’d
have done it if he’d stood over me with a drawn sword. But, Harry, you
never speak a word. Are you cold? come and sit here by me on the warmest
side. ’Twill be as cosy here as if you were in a pie; and I’ll give you a bit of
my shawl. Come, lad! pluck up a heart: I’ve nigh cried my eyes out; but that
does no good. I can’t see you, Harry; but I know you’re down, though I
can’t see.”
“Down!” he said, “Can a fellow be anything but down with a raging wild
beast for a father, and shut out of every shelter through a cold spring night.”
“That’s very true,” said Joan, “and I’m no example, as you’ve seen; but
still I’m in the same box if that’s any consolation.”
“No, it is no consolation,” said Harry; “it makes it worse; for if you are
here perishing of cold it’s all on my account.”
“I’m not perishing of cold. I’m as hearty as a cricket. If he thinks he’ll
break my spirit he’s much mistaken; and that’s all about it. It did touch me
the first minute. I feel that I was just a big baby. But after all, Harry, if you
will stay out till all the hours of the night, and go to that ‘Red Lion,’ which
is known to have ruined many a lad——”
“Oh, hold your tongue about the ‘Red Lion!’—you are as bad as old
Isaac. Where am I to go?”
“What’s to prevent you biding at home?” said Joan. “Dear me, you’re
not such a deal better than I am, Harry Joscelyn. Where do I ever go? I’ve
been as young as you once upon a time, and what diversion was ever given
to me? and I’m not to say so dreadful old yet. Can you not put up for a
week with what I have put up with all my life?”
“You don’t understand—it’s quite different,” said Harry, hotly; “you’re a
woman, you’re an old—Good Lord, can’t you see the difference? Where
should you be but at home? but what would you have me do, stuck between
two women and that—that father of mine?—” Harry here menaced the dark
world with his fist, and burst, in his turn, into an outcry of passion. “I’ll
neither sleep under his roof nor call him father, nor reckon myself to belong
to him more! You hear what I say, Joan; you can bear witness. Not if I were
to starve; not if I were to die; not if I were to cadge about the streets!—
White House has seen the last of me. You can tell my mother I think upon
her: but she must not expect ever to see me again.”
“Tut, tut,” said Joan, tranquilly; “to be sure you must have your fling. Ay,
ay, say away, my lad; it’s always a relief: and we’ll not keep you to it when
you come to yourself.”
“That’s well for you, Joan,” said her brother; “but for me, I don’t mean
to come to myself. He’s done it, I can tell you. What did he ever do for me?
but if he had been the best father in the world now he’s made an end of it.
Am I to be treated like this, home on a visit and I cannot put my affairs
before him, and ask for my share to buy me into the business, but I’m met
with abuse: and when I go out for a little peace the door’s shut upon me.
You can do what you please, but I’ll not stand it. We’ve all lived a wretched
life, but I’ll make an end of it. Don’t you think it’s all a flash-in-the-pan,
and that I don’t mean what I say.”
“Well, well, lad—if it keeps your spirits up a bit. Are you not sleepy?
Let’s make the best of it. Harry: after all it’s but one night. Though this is
not to call an easy seat. I’m that sleepy I shall go off, I know I shall. If you
see me tumbling be sure you catch me. I cannot keep awake another minute.
Good night, lad, good night.”
This was half real, on Joan’s part, and half put on to calm her brother
down; but in that part of her intention she was not very successful. After a
while she really did as she had threatened, and fell into a sound, if uneasy,
sleep. But Harry had no inclination that way. He sat and pondered over all
his wrongs, and as he mused the fire burned. What was home to him?—
nothing. A place where there was no peace—a pandemonium—and when
there was either quarrelling or dulness—dulness beyond description; either
a fight with his father or a drowse by his mother’s side—that was all the
comfort he had of his home. And after all, when he put the question to
himself, and nobody else interfered, he was obliged to allow that the
entertainment at the “Red Lion” was not of a very exciting character. There
was not much in that to make up for the want of everything else. He sat
upon the edge of the copper dangling his legs, and, notwithstanding that
warmth, the chill of the night got into his heart. He had no overcoat, as his
mother had remembered, when he went out; and as the slow moments
passed on, the night became intolerable to Harry, and the sense that his
enemy, his father, was chuckling in the warmth upstairs over his outcast
condition, distracted him with impotent rage. Never again would he subject
himself to such a shame. He clenched his fist and made a vow within
himself, while Joan, leaning her head against him, slumbered uneasily.
After a while Joan had a little shock in her sleep, half woke, and felt her
pillow displaced, and dreaming, not knowing where she was, threw herself
back against the copper and settled down somehow again. She dreamt there
had been an earthquake, and that the copper itself was a volcano and had
made an eruption and tumbled down upon her, catching her fast by the feet.
A little after, poor Mrs. Joscelyn, lying awake crying silently and saying her
prayers over and over again, heard a handful of gravel flung violently
against her window and the sound of footsteps. What did it mean? The
tyrant had gone to sleep a few minutes before, and he slept heavily. She
crept out of bed with a sinking heart, and after a great deal of alarmed
searching found the keys, of her own room first, and then of the doors
below. She did not even turn to find something to cover her, but fled
downstairs, like a ghost, with her naked feet and a wild flutter in her heart.
When she made her way with some difficulty to the place where her
children had found refuge, she came just in time to deliver Joan, who had
almost broken her neck in her struggles to get out of the way of the
earthquake, and was lying, with her head back and her mouth open, among
the tubs. Though she was conscious of being in some convulsion of nature it
was not easy to wake Joan, and there was no one else to be seen. Mrs.
Joscelyn, with her candle in her hand, went searching into every corner
while her daughter picked herself up. “Harry,” she cried, “Harry! oh where
is my boy?” There was not a trace of him about; not even an impromptu
couch, like Joan’s, made up of benches and washing tubs. The mother
flitted about into all the offices, while Joan roused herself with many
yawns, rubbing her stiff neck and knotting up her straggling locks, and
gathering her shawl round her shoulders. “Oh that copper,” Joan was
saying, “it’s been the saving of my life.”
“But where is my boy? Oh! Joan, what have you done with him? Where
is my boy?”
“I have not got him in my pocket,” Joan said, with a sleepy smile. Then
as she roused herself quite up, “To be sure, mother, the lad’s not a fool
though we give him the credit of it. He’s gone back to his blessed ‘Red
Lion,’ and is safe in his bed, as I would like to be. And if I had let him alone
and not poked in where I wasn’t wanted, there’s where he would have been
from the first. You see that’s just your way. I have a little bit of it in me, if
not much; and, instead of letting him be, I must meddle. But he’s safe in his
bed at the ‘Red Lion;’ and you’d better go back to yours, and let me go to
mine, and make the best of a bad night.”
“I cannot think he has gone to the ‘Red Lion,’ ” said Mrs. Joscelyn,
standing in her white nightdress, with her glaring candle, against the great
darkness of the night in the doorway, and investigating the gloom by that
poor assistance with her anxious eyes.
“Then where else would he go to?” Joan said.
CHAPTER VI.

A NIGHT WALK.

T HE moon had set when Harry Joscelyn left the White House; and the
night was very dark, as it is so often after the setting of the moon. The
sky was cloudy, and scarcely a star was visible. The wind blew cold in
his face when he got beyond the shelter of the walls. He looked up at the
house as he passed it with a sensation of rage and contempt which it is only
possible to reach when the object we thus hate and despise is one that ought
to be beloved. He lifted a handful of gravel and threw it violently at his
mother’s window. There was no softening of feeling, no wish to say a
farewell, even if an angry one in this. It was done in boyish rage, with a
simple desire to strike. He was glad to think the stones struck sharply, and
might, perhaps, have broken a pane and fallen like shot upon the floor. This
was what he would have wished. When he had discharged that parting
volley, he pulled down his hat over his ears, and put up his coat-collar. It
was all he could do against the wind, which blew through and through him.
Not even an overcoat! They were determined that he should have nothing;
that he should be expelled without even the poorest covering; that he should
be exposed to everything dangerous, everything disagreeable. To be sure,
that was what they wanted! Revenge filled the young fellow’s heart as he
went along in the dark, shivering at first, till his rapid progress set his blood
in motion. Not only without a home, without a roof to shelter him, or a bed
to lie upon, but without even a coat. He turned his back upon his father’s
house with a bitterness that was indescribable. He could remember the time
when it was delightful to him to go home; but that was long ago, when he
was a boy and knew no better. Even then, what had his father been to him?
a terror even in his lighter moods, which might turn into fury at any
moment. His mother? oh, his mother had been kind enough, poor soul! For
a woman she had done what she could; but at the best what could a woman
do? Poor thing! yes she had been kind. But it is very difficult for the young
to see anyone, even when dear to them, systematically undervalued without
getting to share the sentiment in one shape or another. Sometimes it rouses
a generous mind to hot partizanship; but Harry had never got that length.
He had been indignant sometimes and conscious, with a little pride, that he
was the one who stood up for his mother—but he had not gone further. And
now he could not help despising her as everybody else did. Just when it was
essential she should stand by him, she had failed him. Call this the
consequence of force which she could not resist, of natural bodily weakness
—all that was very well to say; but a mother worth anything will never run
the risk of bodily force in such an emergency. She will find some way of
getting out of it. She will stand by her son when he needs her, whatever
happens. And Harry’s mother had not done so—just at the critical moment
when he had been driven wild by opposition, when his future career had
been to all appearance cut short and his path shut in before him, she had
failed him! She was as weak as water; there was no faith to be put in her. A
woman like that, Harry reflected, is almost as bad as if she were not a good
woman. Oh, yes; she was a good woman! but what advantage was it to
anyone? What did it matter being good if you were of no use to those
belonging to you? Being good just for yourself, selfishly, that was a poor
sort of business. For her children she was no good. What had she ever done
for any of them? Made a fuss, as Joan said. She was very good at doing
that, was mother! But what more? These were the angry thoughts that were
surging through his mind as he turned his back upon his home. His father’s
image swept across him now and then, raising his angry despair into
momentary rage; but it was not his father, who had always been hard upon
him, but his mother, who had always been so tender to him, whom Harry
assailed with all these bitter thoughts. In her silly dislike to the only poor
little amusement he had, she had turned against him at the decisive moment.
It was just like a woman! Because he would not tie himself to her apron-
strings; because he would not spend his evenings sitting with her and Joan
—a pretty sort of position for a young man, Harry said to himself, with a
curl of his lip.
He went on shivering, straight before him as he happened to have turned
his face when he came round the corner of the house. He was not aware that
there was more choice in it than this, though all the while there was a
dormant intention in his mind of going to Wyburgh after all, and trying, one
last effort, what Uncle Henry would do for him. Uncle Henry had been kind
to him, as kind as he knew how. He was only an old bachelor, not much
good, a selfish old fellow, thinking most of his own comfort; but still he had
been kind; and perhaps if he knew fully the state of the case, and how the
people at White House had treated his pupil and godson—This was lying
underneath as it were the current of Harry’s thoughts, and turned over and
came uppermost for a moment now and then; but it did not become at all a
principal idea until he had walked a long way, and had got warm with
walking, and the sense of absolute misery, physical and mental, had been
slightly modified. At first he kept to the side of the Fells, which was rough
walking, and where now and then there was a dyke to jump over or a beck
to cross; but by and by got down to the high road, almost groping the way
with his feet, if not with his hands, so black lay the night over the irregular
broken ground. He knew the road, every inch, he would have said; but
when that darkness comes down like a pall, confounding everything in one
gloom, there is little advantage in knowledge. Sometimes he found himself
right up against the grey uncemented stones of a dyke before he was aware
of any obstacle, and sometimes had almost plunged into an invisible hill-
side stream, before the little warning trickle it made among the stones
caught his ear. By the side of one of these little streams he made his way to
the road, and there for the first time asked himself where he was going.
What a strange walk it was, all blank about him, sometimes a lonely tree
rustling, betraying itself in the dark by the wind in its spare branches,
sometimes a cottage suggested on the roadside, or away among the fields,
by the cry of a child or the bark of a dog. He knew he had passed through
the first hamlet on his way, because the dogs all woke at the unusual sound
of a footstep, and barked at him lustily. He was not a youth of much
imagination, and yet this incident had the most curious effect upon him. He
was more startled, more shocked and annoyed by it than by anything else
that had happened to him. The very dogs! was he already to them a tramp, a
wandering vagrant? At the very end of the “town” some one opened a
window, and Harry heard a querulous question, not addressed to himself,
but to some one inside, “Wha’s that wandering on the road in the dead o’
the night?” Harry slunk by, trying to keep his steps from making so much
noise. A sense of disreputableness suddenly came over him, a recollection
of what people would think. Nobody would believe he had been turned out
of his home for no fault of his. And then in the midst of his fury and desire
for vengeance, there suddenly came over Harry that family pride which so
seldom abandons a Northcountryman. Was he going to let everybody know
what disgrace there was in the White House, and how his father had turned
him out of doors? Were all the tongues in the country-side to be set wagging
on this subject? The Joscelyns—people so well known! Harry felt as if
some one had struck him sharply with his hand in the darkness. It would be
all over the country in twenty-four hours. Joscelyn of White House had
turned his youngest son out of doors. There was no second family of the
name to confuse gossip. Harry felt as if the barking of the dogs was but a
foretaste of what was going to happen to him. He felt as if some one had
grasped him, choked him, tried to strangle him in the dark.
Fortunately Wyburgh by this time showed, a long way off with its little
lights twinkling. They were but four little rustic lights, not many of them—
for when the moon shone the corporation felt itself at liberty to dispense
with lamps; and but for the lights at the railway-station, and two or three
which were indispensable, the little town would have been invisible in the
darkness, like those sleeping villages which Harry had stumbled through
almost without knowing. When he caught sight of the first of these lights, it
gave him a keen pleasure; it seemed to deliver him from that world of
blackness in which the only conscious and living thing was himself and the
sea of thoughts which surged up and down within him, one wave sweeping
over another, in a confusion and tumult indescribable. Harry’s soul caught
at the glow of that tall solitary lamp, the first which marked the line of the
railway, as at a guiding light directing him into a known country, to solid
ground and a familiar shore. The darkness and the little inward world of
thought were alike strange to him, and he had no guide to direct him
through them; but now here was “kent ground,” a place which would be
visible, where the dogs would not bark at him in the dark, where there were
all the safeguards of an inhabited place. He was relieved beyond measure
when he saw the lights, and said to himself what they were. That was the
tall light on the line, that other lower one the lamp at the station, that the
faint little flare seen over the housetops of the market square, and yonder
the well-known lamp at the corner, which he had seen lit so often as he left
the Grammar-school. It made his heart light to count them at a distance. But
when he got to the outskirts of the town he was less happy. It was still quite
dark, between three and four o’clock, and he could not go to Uncle Harry’s,
or to any other house in which he was known at such an hour. Nobody was
stirring in Wyburgh, nor would be for hours yet. As he went into the silent
streets the sense of his desolate position came over him more strongly than
ever. All the houses were shut up and silent, blinds drawn over the
windows, feeble lamps burning here and there like night-lights in a sick-
chamber, the whole place breathing low and noiselessly in its sleep. He met
a policeman, the only one, making his rounds with steady tramp, and the
policeman looked at Harry with suspicion, throwing the light of his dark
lantern upon him as he passed. He knew John Armstrong very well, and had
played him many a trick as a schoolboy; but he shrank from making himself
known now; and John looked with suspicion at the wayfarer, without even
an overcoat, buttoned up to the neck, and with his hat drawn over his eyes,
who thus invaded the town in the middle of the night. Harry knew that he
was but a tramp, all the more dangerous because better dressed than usual,
in John’s eyes. He felt the light of the lantern come after him, making a long
trail of light upon the pavement. And he did not know where to go. If he
went wandering about, which was the only thing he could think of, no doubt
he would meet John Armstrong again, and almost certainly be questioned as
to what he was doing, and who he was. And then the story would run over
Wyburgh, how young Harry Joscelyn, one of the Joscelyns of the White
House, had come in to Wyburgh before four o’clock in the morning,
walking like a vagrant, and was recognized by the policeman, roaming
about the street without any place to go to. He might almost be taken up as
a rogue and vagabond, Harry thought, with that exaggeration which
misfortune delights in. If he were called upon to give an account of himself
he could not do it, nor had he any place to go to, any home waiting for him.
The Wyburgh folk might form their own conclusions, and so they would,
could anyone doubt.
He walked straight through the town to the other end of it, as if he were
going on somewhere else, ashamed of himself, though he had nothing to be
ashamed of, avoiding the spots of feeble light round the lamps, and walking
as softly as he could not to make so much noise upon the pavement. He had
not felt this so much in the country, in the darkness, but here, where
everybody knew him, he became suddenly ashamed and afraid of being
seen. When the clock struck it made him jump as if it had been some one
calling his name. “Harry Joscelyn is roaming about the country without a
home to go to;” did he think that was what it was going to say? Alas! it was
but four o’clock that struck; four o’clock! the night seemed to have been
already twelve hours long; and here were two hours more at the least that he
must get through somehow before he could hope that even Mrs. Eadie,
Uncle Henry’s old housekeeper, would be astir. He would not mind
presenting himself to her; and the thought of the kind unquestioning
welcome she would give, the cheerful fire, the breakfast, the warm room in
which he could sit down, gave him sudden encouragement. For it was very
cold; those long, long hours of night, which pass so quickly in sleep, sliding
out of consciousness altogether, how much goes on in them to those who
are homeless! Harry had never thought of anything of the kind before; a
night without rest, even, far less a night out of doors, had been unknown to
him. The wretches who wander about the roads, and sleep under a hedge,
and have no home, were out of his ken; they were poor wretches, and in all
likelihood it was “their own fault.” People would think the same of him. To
be ashamed of the position in which you find yourself, and yet to be quite
innocent, is a curious misery, but it is very poignant. He had done nothing
wrong; but the light of John Armstrong’s lantern made him shrink, and even
those pale little prying lamps, each making a hole in the darkness. He went
straight through Wyburgh, coming out at the further side. He walked till he
was quite clear of the houses, and then he turned and looked back upon the
spots of light which had cheered him so much when he first caught sight of
them. How cold it was! nobody would believe that a spring morning could
be so cold. It was like December. There was the clock again, like some one
shouting in his ear—but only sounding the half after four; would the night
never come to an end? He walked up and down on this bit of quiet road, just
outside the town, to keep himself warm, pausing now and then to lean upon
the wall and look at the lights; though he dared not go back to them lest
they should betray him to the gossips, yet it was a kind of consolation to
look at them still. They delivered him a little from that close presence and
wretched company of himself.
An early cart from one of the neighbouring farms with vegetables for the
market, lumbering along the road just as the day began to break, was the
next thing that disturbed him. He fled from that too, wondering what the
carter would think to see him standing there like a ghost in the dim dawn—
and got over the wall into a field, to be out of the way, yet could not help
feeling, as he listened, holding his breath, to the sound of the slow, jogging
horses and the man’s heavy tread, that the carter must have spied him, and
must be peeping over the wall and wondering who he could be. By this time
Harry had got to feel very like a criminal. He felt sure that everybody would
think he was a criminal and had done something desperate, to see him there
in this guise. And how he was to get courage to go back to Wyburgh again
in full daylight, in the sight of everybody, and knock at his uncle’s door, he
did not know.
“Lord bless us! Master Harry!” the housekeeper cried. He came upon her
suddenly as she opened the door to go out and feed her chickens, which was
the first thing she did every morning. She was so scared that she let fall her
apronful of seed, and held up her hands half to protect herself, for this worn,
pale, wearied apparition, with coat-collar up to its ears, and hat drawn down
over its brow, was like the ghost of Harry, not himself. “Lord bless us!
Master Harry! it’s never you?”
“It is me, though: and dreadfully tired, and so cold I don’t know what to
do with myself,” said Harry, with chattering teeth. “Let me come in and
look at a fire.”
“Let you come in, my bonny boy! you shall come in, and welcome; and
the kettle’s on, and I’ll soon make you some tea. Come into the kitchen, it’s
the warmest place. Bless the lad! What hour did ye start at to get here so
early? or has anything happened? You’ve not come for the doctor? I’m that
surprised you might blow me over with a puff of your breath.”
“I shall not try,” said Harry, recovering himself a little as he felt the
warmth of the fire. “There’s nothing wrong, Mrs. Eadie, they’re all well
enough; but I want to see Uncle Henry, and I’m going back to Liverpool to-
day.”
“Bless my heart! I thought you had come for a real holiday, and its no’
above a week; but whisht! laddie, dinna chatter with your teeth like that;
come nearer to the fire. Dear, dear me, but you must be cold; not a great-
coat upon your back, nor a comforter, nor one thing to keep the heat in ye. I
hope you havena’ just gotten your death,” cried the housekeeper, pouring
the steaming water, which it was good even to see, into her teapot; and in
her anxiety to get him a comfortable meal she forgot to ask any more
questions.
Mrs. Eadie’s help, who was a young girl, did not live in the house, and
her late arrival in the mornings was one of the grievances of the
housekeeper’s life. There was nobody, therefore, but this good woman, in
whom Harry had perfect confidence, to witness his worn-out condition: and
by-and-by he got thawed and comfortable. Once within this legitimate
shelter too, his spirits came back to him. He forgot the painful miseries he
had conjured up, or, at least, he did not forget them, but they went to his
father’s account to swell his wrath. There were still several hours to wait
before he could see Uncle Henry, and Harry lay down upon the bed where
he had slept when he was a schoolboy, and returned to common life and
respectable usages through the medium of a long sleep. It was a sort of
moral bath to him, restoring him to creditable ways. To think that he should
have feared John Armstrong’s lantern, and hid himself from the carter with
his early vegetables! But all that, and a great deal more, went to his father’s
account. His rage revived as the misery of the night ended. For those latter
hours he had been too much occupied by his personal feelings to dwell
upon the cause of them; now that he was comfortable once more the insult
and the cruelty that had been inflicted upon him came back with double
force. Turned from his father’s door, the key turned upon him, the house he
was born in shut up against him; himself disowned, like a beggar, left to
wander where he pleased, to die on the moors, if he liked, to get his death,
as Mrs. Eadie had suggested; and all this his father’s doing! Harry clenched
his fist with wild excitement, with a desire for vengeance which startled
himself. He thought he would almost consent to have “got his death” if
Joscelyn could be tried for manslaughter. He would have almost liked to
punish, to convict his father by dying, so that the whole country might have
pointed at him as the man who had killed his son. But then he reflected that
probably his father would not care. “But I’ll make him care,” Harry said to
himself. Few people venture to express such vindictiveness; but Harry
Joscelyn’s heart was full of it; it was natural to his race.
CHAPTER VII.

UNCLE HENRY.

M R. HENRY JOSCELYN came down stairs at nine o’clock to breakfast


as he always did. No clock was ever more regular. He was not like the
present family of Joscelyns. He had taken after his mother, who was
the grandmother of Ralph Joscelyn of the White House. The family had
been one of greater pretensions and more gentility in his day. The heir at
that time was educated in Oxford, and the Joscelyns still belonged, though
gradually falling away from it, to the higher level, and counted themselves
county people. Henry had been sent off early to business; but he had never
lost the sentiment which so often remains to an “old family” when more
substantial possessions are gone. In the case of the present representative of
the name this sentiment was mere pride with a bitter edge to it, and
resentful sense of downfall; but with Mr. Henry Joscelyn it was a real
consciousness of superiority to the common persons round him. Noblesse
oblige: perhaps he did not understand these words in their highest sense.
The noblesse was small. And the behaviour it exacted was not of a princely
or magnanimous character; but still there were many things which, being a
Joscelyn, he felt it incumbent upon him both to do and not to do. He would
not allow himself to drop. He looked with indignation and contempt at the
rudeness and roughness of his nephew’s house. Even what was best in it
was, he felt, beneath him. He had never married at all, not feeling able to
aspire to the only kind of wife he ever could have been content with; but to
marry a parson’s daughter was an expedient Henry Joscelyn would have
scorned. It would have better befitted the reigning head of so good and old a
race to have followed the example of King Cophetua—a beautiful beggar-
maid is a possibility always, but an insipid parson’s daughter! Mr. Henry
Joscelyn had not cut his nephew—that would have been impossible too; but
he looked upon him with a fierce contempt; and though he allowed Mrs.
Joscelyn to be “a worthy person,” and probably quite good enough, nay,
even too good, for Ralph Joscelyn as he was, still Mr. Henry could not meet
her on grounds of equality—notwithstanding the fact that there was a
baronet in her family, which at first had staggered him. It did not seem to
him that these high claims of his were at all injured by the fact that he
himself had been engaged in, and had made all his money by, trade. “I was
a younger son,” he would say, with a gentle shrug of his shoulders, and his
godson Harry was also a younger son. Mr. Henry believed that there was a
certain amount of self-sacrifice necessary in a family. If it was a right and
good thing to keep it up, then it was quite right that the younger children
should have their part in sustaining its honour. Its importance, its prestige,
belonged to them as well as to the heir, and it was their interest as well as
their duty to make an exertion and keep it up.
His own exertions had not succeeded badly; he had been able to come
back to his own county, while he was still not an old man, and to settle
himself according to his pleasure. Now Mr. Henry’s opinion was that you
could not live absolutely in the country unless you had “a place” in the
country, and all the consequence that brings. His notions, it will be seen,
were a great deal higher than his real position; he thought of the Joscelyns
as if they had been a ducal house. And without “a place” he considered a
country life impossible. He did not choose to live in a small house in the
shadow of a great one. Had the White House really been a great ducal
establishment he might have done so; but as he could not so much as look at
the White House without a sense of its discrepancy with the pretensions of
the family, and unlikeness to everything that the mansion of the Joscelyns
ought to be; and as the society there, when there was any society, was
distinctly below, not above, his own level, he did not hesitate a moment as
to his place of abode. He bought a house in Wyburgh, the county town; a
modest house—but he did not want very much—where he was served most
comfortably and carefully by Mrs. Eadie, the most excellent of managers,
with the assistance of one small aid, and compensated himself for the
smallness of his establishment within doors by keeping a groom and a
couple of horses, which were his personal luxuries. No horses in the
country were more carefully groomed, and no groom presented a more neat
and spruce appearance; and Mr. Henry still rode across country, though not
with the daring which once sat so oddly on his prim little person. For he
was little and light-coloured, exactly the reverse of the Joscelyns, like his
mother, the small pale woman, whose over-masterfulness and tyrannical
control of her sons, was said to have turned her grandson, the present man,
and his father before him, to evil courses. She had wanted to make them
good, to perfect their characters, whether they would or not; and the strong
restraint she had exercised had made the re-action all the more vehement.
So people said: except in the case of Henry, who took after his mother in
every way, and had all her intolerance of useless people and indolent minds.
He lived a life which was very satisfactory to himself in his little house in
Wyburgh. He had besides a little bit of land in his native parish with an old
house upon it, uninhabitable, but yet a creditable sort of possession in a
corner of which Isaac Oliver—who was, in a very lowly manner his bailiff
—lived with his family. Mr. Henry was a much respected member of the
county club which had its seat in Wyburgh, and to which his nephew of the
White House might have sought admittance in vain. The duke himself
treated old Henry, as he was called, with the utmost condescension. His
position was never contended or doubted. He was as good a gentleman as
the king. He knew more about the county than anyone else did, and called
cousins remotely with many of the great people, who were most
courteously ready to allow the kindred so far as Mr. Henry Joscelyn went;
and he was an active magistrate, and took a certain interest in the town
itself, where most people believed in him, and wondered how the Joscelyns
could have gone off so completely since Mr. Henry’s time—which was like
the period before the deluge to the young people. And Mr. Henry was a man
of the most regular habits. It might have been known what hour it was, had
the town clock stopped in Wyburgh, by his appearance at the window, after
he had breakfasted, with the newspaper in his hand, by the sound of his step
as he went to the Club regular as the sun himself, and by his return to his
dinner. These were the three departures, so to speak, of his day. In the
evening he dined out sometimes, at the Rectory, at Dr. Peregrine’s, or with
Mr. Despond, the solicitor: and now and then with some of the greater
people about, where he drove in his own little brougham, which he kept
expressly for such occasions. At other times one or two old inhabitants of
the better class would drop in in the evening to make up his rubber. He
looked very well after his money, and gave his neighbours excellent advice
about their investments; and a more admirable member of society, a more
respected townsman, could not be.
It may be supposed that to such a man, with such a life, the existence of
a schoolboy under his roof had not been an unmixed pleasure. Still Mr.
Henry Joscelyn was not a man to fail in his duties when they were pointed
out to him. Though nobody but Mrs. Joscelyn guessed it, it was to the
housekeeper that his family were indebted for Harry’s preferment. Mrs.
Eadie was just then greatly in want of somebody to be kind to. Her master,
though he required the most scrupulous attention, did not come within this
category, and the good woman had long sighed for a bairn in the house.
When Harry was in the house he did not see much of his uncle—their hours
(thank heaven! Mr. Henry said, devoutly), being quite incompatible. The
boy was off to school in the morning, long before Mr. Henry was up. He
had his dinner in the middle of the day, when Mr. Henry was engaged in
magisterial or county business, or in the Club. So they got on very well, and
the old man was actually sorry when the boy set out in his turn for
Liverpool to get an insight into “the business” in which his uncle had grown
moderately rich; but this did not affect his methodical life, which flowed on
just as before. Mr. Henry was growing old; even he himself acknowledged
this, with cheerful readiness to other people, with a little impatience to
himself. He spoke of his age with great equanimity in society when the
subject was mooted, but he did not think of it when he could help it, nor did
he like the thought. High and dry above all mortal loss and gain, quite safe
from the agitations of life, very comfortable in all its circumstances, having
succeeded in working out just the perfection of detail, the harmony of
movement that satisfied him, it was a vexing and unpleasant reflection that
this life was to be disturbed, broken in upon, brought to a conclusion by
illness and death. Sometimes the thought made him almost angry. Why? He
was not, to be sure, so strong as he once was, but he was strong enough for
all reasonable purposes, as strong as he required to be; and he had all his
wits about him. Never had he been more clear-headed; and every sort of
inclination to do things that were not good for him, whether in the way of
eating or drinking, or other practices of a more strictly moral or immoral
character had died out of his mind. He knew how to take care of himself
exactly, and he did take the greatest care of himself. Why should he die? It
was an idea that annoyed him. It seemed so unnecessary: he was not weary
of life, nor had he the least desire to give it up. In such circumstances there
had been a lurking feeling in his mind that Providence should know how to
discriminate. But there was no telling how long Providence might choose to
discriminate: and this recollection was about the only disturbing influence
in a life so comfortable and well proportioned, and altogether satisfactory,
that there seemed no reason whatever that it should ever come to an end.
“Mr. Harry here? How did he get here at such an hour in the morning?
Why, he must have started in the middle of the night.”
“I make no doubt of that,” said the housekeeper. She had brought up a
second kidney, piping hot, and tender as a baby, upon a piece of toast, so
crisp yet so melting, so brown and savoury, so penetrated by generous
juices that it was in itself a luxury; “and for that and other things I have
made him lie down upon his bed. He’s not been in a bed this night, that’s
clear to see; he’s sleeping like a babe in a cradle; it does the heart good to
see him.”
“I don’t think it would do my heart good,” said Mr. Henry, “the young
fellow must have been up to some mischief. Did he give you any idea of
what was the matter? or is it mere nonsense, perhaps a bet, or a brag, or
something of that sort?”
“Mere nonsense—nay, nay, Sir, it’s not that. He’s got a look on his face
—a look I have seen on your own face, Sir, when you are put out.”
“I’ve told you a hundred times, Mrs. Eadie, there is not the slightest
resemblance between Mr. Harry and me.”
“And how are you to tell that, Sir, that canna see the two together? You
are far more clever than me in most things; but my eyesight I must trust to.”
Mrs. Eadie made a little curtsey when she opposed her master. She had a
conviction that it gave him a secret pleasure, though he would never confess
it, to hear that Harry was like him; and perhaps she was right.
“Have your own way,” he said; “but that makes no difference to the
question. What’s wrong? has he said nothing to you? You used to be great
friends.”
“I’m his true friend; and stiddy well-wisher, as much good as I could do
him; and Mr. Harry has always been very kind,” said the housekeeper,
putting her master’s sentiment in her own softest words; “but he has said
nothing to me. I did not look for it. He would not, being one of the proud
Joscelyns, saving your presence, Sir, take a servant into his confidence.
Though he’s aye been very kind.”
“We are proud, are we?” said her master, with a half smile; “well,
perhaps that is a fault of the Joscelyns, Mrs. Eadie. You can send him to me
when he wakes. Of course now that he is here I must listen to what he has
to say.”
But Mr. Henry sighed. He ate that delicious kidney with an internal
sense of annoyance which took half the savour out of it. He said to himself
that it was always the case: when he came down in the morning with any
unusual sentiment of comfort and well-being, something always happened
to put him out. As sure as that light-heartedness came, something would
follow to pull him down, something would go wrong in the Club, or his
conduct in some petty session case would be aspersed in the “Wyburgh
Gazette,” or some old friend of his boyhood would send him a begging
letter, or—still more annoying, something about the White House family
would interfere with his digestion. “I might have known,” he said to
himself. He had got up at peace with all men; with absolutely no care which
he could think of when he woke and swept the mental horizon for causes of
inconvenience, as it is one of the privileges of humanity to do—absolutely
nothing to bring him any vexation or annoyance. He had believed that he
was going to have a comfortable day. A little uneasiness which he had felt
in his foot (he did not say, even to himself, in his toe), had gone off; a
stiffness which he had been conscious of had disappeared; the wind had
changed, going round to the southward, and the morning was quite warm
for the time of the year. He had not been buffeted about by the night wind,
as Harry had, and at six in the morning, when poor Harry was so cold, he
had been as warm as he could desire in bed. When he came down stairs the
fire was just as he liked it, the newspaper with the chill taken off it, neatly
cut, and folded, and a letter from the Duke, with a seal as big as a penny,
was lying by his plate. It was an invitation, and Mr. Henry was much
pleased. Never had a day begun more auspiciously. He had sat down,
opened his napkin, poured out for himself an aromatic cup of coffee, laid
the newspaper before him conveniently, so as to be able to glance his eye
over the news, while he addressed himself to the more solid part of the
meal. And it was while he was thus beginning the day, in peace with
himself and all about him, that “the woman,” as he called his housekeeper
when anything went wrong, appeared with that kidney, and the cloud which
was to overshadow the whole day. Of course it must be something wrong.
Why could not the woman have recommended that boy to go back again,
and make it up with his father, and not bother another person with his
troubles? Had not every man troubles enough of his own? But he had been
too comfortable. It was just as it always happened—whenever he felt
particularly at his ease, something, some annoyance or other, was certain to
come. He sighed impatiently as Mrs. Eadie withdrew. But then he felt it to
be his duty to himself to put all anxiety out of his thoughts, and to address
himself seriously, if not with such a sensation of comfort, to his breakfast; it
would do no good to himself or anyone if he put his digestion out of order
for the rest of the day.
He had finished his breakfast and read his paper, and done some trifling
businesses such as were of importance in his easy life, before Harry
appeared. When a man or woman lives at perfect ease, with nothing to do,
there are always some solemnities of supposed duty which they go through
for their own comfort, to give a semblance of serious occupation to their
day. With some people it is their correspondence, with others the rain-gauge
and the thermometer, which they register with as grave a countenance as if
the comfort of the country depended upon it. Mr. Henry’s duty was the
Club. He was looking over the accounts of the last half year with serious
devotion. He spread this over a long time, doing a little every day,
comparing all the items with their respective vouchers, and with the
expenditure of the previous half year. All had been perfectly satisfactory till
this morning; but to-day he discovered that the sale of the waste-paper was
not entered in the previous month, which made a difference of some seven
shillings and sixpence, or thereabouts, in the half year’s accounts, a
difference such as ought not to have occurred. He could scarcely help
feeling that this would not have happened had it not been for the very
inopportune arrival of Harry, and introduction of the troubles of a family,
things he had systematically kept clear of, into his comfortable and self-
sufficing life.
He had just made this discovery—which obliged him to refer to the
expenditure in the corresponding quarters of last year, and several years
before, and make close investigation into what had then become of the
waste-paper, and who had bought it, and what price it had brought; and had
made a careful note in his pocket-book of various questions to be put to the
butler at the Club, who had the practical management of affairs—when the
door opened and Harry appeared. Mr. Joscelyn looked up and made an
instant mental estimate of his nephew, whom he had not seen for some time,
on not very just grounds. Harry had been immensely refreshed and restored
by his breakfast, and the consciousness of having a roof over his head, and
a legitimate right to be here; but his sleep perhaps had not done him so
much good. At five-and-twenty a man can do without a night’s rest with no
very great inconvenience; but to have a snatch of insufficient sleep is of
little advantage to him. It had made his eyes red, and given him an
inclination to yawn, and confused his head. He had the look of a man who
has been sleeping illegitimately, sleeping in daytime when other men are
awake; and he was unshaven, and he had on a shirt of his uncle’s, which
was too tight at the throat, and otherwise of a fashion not adapted to a
young man. His dusty coat had been brushed, and he was not really travel-
soiled or slovenly, much the reverse indeed, for his appearance had been the
cause of much more searchings of the heart both to himself and kind Mrs.
Eadie than was at all usual in respect to Harry’s simple toilette; but that air
of suppressed fatigue and premature awakening, and altogether wrong-
sidedness, was strong upon him. And he was deeply conscious of it. He
knew exactly how he looked, with his eyes rather red, and that blueness on
his chin, and Uncle Henry’s collar cutting his throat; and a great many
doubts as to his reception by Uncle Henry—doubts which had not entered
his mind before, arose within him in that first moment when, opening the
door, he met the startled eyes of Mr. Joscelyn over the top of his spectacles,
lifted to him with an alarmed and inquiring look. Harry saw that in a
moment he was weighed in the balance and found wanting. This did not
give him more ease in his manner, or a less painful sense of being on his
trial.
“Good morning, Harry. I hear that you were a surprisingly early visitor
this morning; but you keep early hours in the country. I hope there is
nothing amiss at the White House.”
Mr. Joscelyn held out a hand, of which he was rather proud to be shaken
by his grand-nephew. It was, he flattered himself, a hand that was in itself a
guarantee of blue blood. Harry embraced it in the grasp of a powerful
member with none of these qualities, and gave it a squeeze much more
energetic than he had intended.
“There is a good deal amiss with me,” he said. Harry had been debating
the point with himself for the last half-hour, whether he should fully confide
in his uncle or not. He could not but feel that it would be wiser to deal
lightly with the fact of his exclusion from his father’s house; but he was so
angry that he could not be prudent, and the moment that he had an
opportunity of speech his temper broke out.
“I was not in bed all last night,” he said; “I was on the road like a tramp,
Uncle Henry. My father turned me out of the house—”
Three lines came across Mr. Henry Joscelyn’s brow—three horizontal,
well-marked lines. These were two too many. When he was sympathetic a
slight indentation over his eyebrows was all that appeared. The second
meant doubt, the third annoyance.
“Dear me!” he said, “how did that happen? I fear you must have been
doing something to displease your father.”
“Who can help displeasing my father?” cried Harry. “I am sure, Uncle
Henry, you know him well enough. I had been doing nothing wrong. I had
been trying to get him to interest himself in my affairs. He has never done
anything for me, it is you that have done everything for me. I laid before
him a chance I’ve got. I meant at any rate to come and talk it all over with
you; but in the first place I thought it was as well to ask a question about my
mother’s money—”
“Ah—that was not quite an ingratiating way of opening the matter, I
fear,” Uncle Henry said.
“Why not?” cried Harry, forgetting all the prudential rules he had been
trying to impose upon himself. “My mother was willing, and when it would
have advanced my interests—and of course I should have paid as good a
per-centage as anybody else. Surety if there is anything a man can have a
claim upon,” he added, argumentatively, “it must be his mother’s money. I
mayn’t have any right to touch the family property, as I am only a younger
son, and all that—and especially as there are such a lot of us; but my
mother’s money—when it is doing nothing, only lying at interest. Surely a
man has a claim upon that.”
“The man that has a claim upon that is your father, I should say. I never
knew a man yet that liked any questions about his wife’s money,” said Mr.
Joscelyn; “whether it’s in her own power or in his, its not a nice thing to
interfere with. You have your own ways of looking at things, you young
fellows; but in your place I would have said nothing about that. I didn’t
know your mother had any money,” he added, in an indifferent tone.
“It is only—a thousand pounds, Uncle Henry: not what you would call a
fortune—”
Mr. Henry Joscelyn smiled, and waved his hand. Impossible to have
waved away a trifle, a nothing, with a more complete representation of its
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebookgate.com

You might also like