100% found this document useful (1 vote)
7 views57 pages

The Python Advantage: Python For Excel in 2024 Hayden Van Der Post PDF Download

The document discusses the integration of Python with Excel, emphasizing its advantages for data analysis in 2024. It highlights Python's capabilities in handling large datasets, advanced data manipulation, and automation, which surpass Excel's limitations. The text also outlines essential libraries and tools for Excel users to enhance their data analysis skills using Python.

Uploaded by

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

The Python Advantage: Python For Excel in 2024 Hayden Van Der Post PDF Download

The document discusses the integration of Python with Excel, emphasizing its advantages for data analysis in 2024. It highlights Python's capabilities in handling large datasets, advanced data manipulation, and automation, which surpass Excel's limitations. The text also outlines essential libraries and tools for Excel users to enhance their data analysis skills using Python.

Uploaded by

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

The Python Advantage: Python for excel in 2024

Hayden Van Der Post download

https://ebookmass.com/product/the-python-advantage-python-for-excel-
in-2024-hayden-van-der-post/

Visit ebookmass.com today to download the complete set of


ebooks or textbooks
We have selected some products that you may be interested in
Click the link to download now or visit ebookmass.com
for more options!.

Health Analytics with Python: A Comprehensive Guide for


2024 Van Der Post

https://ebookmass.com/product/health-analytics-with-python-a-
comprehensive-guide-for-2024-van-der-post/

Algorithmic Essentials: Trading with Python: Your


Comprehenive Guide for 2024 Van Der Post

https://ebookmass.com/product/algorithmic-essentials-trading-with-
python-your-comprehenive-guide-for-2024-van-der-post/

Financial Architect: Algorithmic Trading with Python: A


comprehensive Guide for 2024 Van Der Post

https://ebookmass.com/product/financial-architect-algorithmic-trading-
with-python-a-comprehensive-guide-for-2024-van-der-post/

Market Master: Trading with Python Van Der Post

https://ebookmass.com/product/market-master-trading-with-python-van-
der-post/
Power Trader: Options Trading with Python Van Der Post

https://ebookmass.com/product/power-trader-options-trading-with-
python-van-der-post/

Python Fundamentals for Finance: A survey of Algorithmic


Options trading with Python Van Der Post

https://ebookmass.com/product/python-fundamentals-for-finance-a-
survey-of-algorithmic-options-trading-with-python-van-der-post/

CALCULUS FOR DATA SCIENCE Hayden Van Der Post Vincent


Bisette

https://ebookmass.com/product/calculus-for-data-science-hayden-van-
der-post-vincent-bisette/

Data Universe: Organizational Insights with Python:


Embracing Data Driven Decision Making Van Der Post

https://ebookmass.com/product/data-universe-organizational-insights-
with-python-embracing-data-driven-decision-making-van-der-post/

Financial Analyst: A Comprehensive Applied Guide to


Quantitative Finance in 2024: A Holistic Guide to: Python
for Finance, Algorithmic Options Trading, Black Scholes,
Stochastic Calculus & More Van Der Post
https://ebookmass.com/product/financial-analyst-a-comprehensive-
applied-guide-to-quantitative-finance-in-2024-a-holistic-guide-to-
python-for-finance-algorithmic-options-trading-black-scholes-
stochastic-calculus-more-van-de/
THE PYTHON
A D VA N TA G E
Python for Excel

Hayden Van Der Post


Johann Strauss

Reactive Publishing
CONTENTS

Title Page
Chapter 1: Introduction to Python for Excel Users
Chapter 2: Python Basics for Spreadsheet Enthusiasts – Enhanced
Chapter 3: Mastering Advanced Excel Techniques with Pandas
Chapter 4: Unraveling Data Analysis and Visualization
Chapter 5: Exploring Integrated Development Environments (IDEs)
Chapter 6: Streamlining Excel Operations with Python Automation
Chapter 7: Bridging Excel with Databases and Web APIs
Additional Resources for Excel
Guide 1 - Essential Excel Functions
Guide 2 - Excel Keyboard Shortcuts
Python Programming Guides
Guide 3 - Python Installation
Step 1: Download Python
Step 2: Run the Installer
Step 3: Installation Setup
Step 4: Verify Installation
Step 5: Install pip (if not included)
Step 1: Download Python
Step 2: Run the Installer
Step 3: Follow Installation Steps
Step 4: Verify Installation
Step 5: Install pip (if not included)
Guide 4 - Create a Budgeting Program in Python
Step 1: Set Up Your Python Environment
Step 2: Create a New Python File
Step 3: Write the Python Script
Step 4: Run Your Program
Step 5: Expand and Customize
Guide 5 - Create a Forecasting Program in Python
Step 1: Set Up Your Python Environment
Step 2: Prepare Your Data
Step 3: Write the Python Script
Step 4: Run Your Program
Step 5: Expand and Customize
Guide 6 - Integrate Python in Excel
Step 1: Set Up Your Python Environment
Step 2: Prepare Your Excel File
Step 3: Write the Python Script
Step 4: Run Your Program
Step 5: Expand and Customize
CHAPTER 1:
INTRODUCTION TO
PYTHON FOR EXCEL
USERS
Understanding the Basics of
Python

I
n today's dynamic world of data analysis, Python has become an
essential tool for those looking to work with and understand extensive
datasets, especially within Excel. To begin this journey effectively, it's
crucial to first understand the core principles that form the foundation of
Python. This understanding is not just about learning a programming
language; it's about equipping yourself with the skills to harness Python's
capabilities in data manipulation and interpretation.
Python's syntax, renowned for its simplicity and readability, is designed to
be easily understandable, mirroring the human language more closely than
many of its programming counterparts. This attribute alone makes it a
worthy companion for Excel users who may not have a background in
computer science.
Variables in Python are akin to cells in an Excel spreadsheet—containers
for storing data values. However, unlike Excel, Python is not confined to
rows and columns; its variables can hold a myriad of data types including
integers, floating-point numbers, strings, and more complex structures like
lists and dictionaries.
Another cornerstone of Python is its dynamic typing system. While Excel
requires a definitive cell format, Python variables can seamlessly transition
between data types, offering a level of flexibility that Excel alone cannot
provide. This fluidity proves invaluable when dealing with diverse datasets.
The Python language also introduces functions, which can be equated to
Excel's formulas, but with far greater potency. Python functions are
reusable blocks of code that can perform a specific task, receive input
parameters, and return a result. They can range from simple operations, like
summing a list of numbers, to complex algorithms that analyze and predict
trends in financial data.
Indentation is a unique aspect of Python's structure that governs the flow of
execution. Similar to the way Excel's formulas rely on the correct order of
operations, Python's blocks of code depend on their hierarchical indentation
to define the sequence in which statements are executed. This clarity in
structure not only aids in debugging but also streamlines the collaborative
review process.
One cannot discuss Python without mentioning its extensive libraries,
which are collections of modules and functions that someone else has
written to extend Python's capabilities. For Excel users, libraries such as
Pandas, NumPy, and Matplotlib open a gateway to advanced data
manipulation, analysis, and visualization options that go well beyond
Excel's native features.
To truly harness the power of Python, one must also understand the concept
of iteration. Loops in Python, such as for and while loops, allow users to
automate repetitive tasks—something that Excel's fill handle or drag-down
formulas could only dream of achieving with the same level of
sophistication.
In conclusion, understanding the basics of Python is akin to learning the
alphabet before composing a symphony of words. It is the essential
foundation upon which all further learning and development will be built.
By mastering these fundamental elements, Excel users can confidently
transition to Python, elevating their data analysis capabilities to new zeniths
of efficiency and insight.
Why Python Is Essential for Excel Users in 2024
As we navigate the digital expanse of 2024, the symbiosis between Python
and Excel has never been more critical. Excel users, standing at the
confluence of data analytics and business intelligence, find themselves in
need of tools that can keep pace with the ever-expanding universe of data.
Python has ascended as the quintessential ally, offering capabilities that
address and overcome the limitations inherent in Excel.
In this dynamic era, data is not merely a static entity confined to
spreadsheets. It is an ever-flowing stream, constantly updated, and requiring
real-time analysis. Python provides the means to automate the extraction,
transformation, and loading (ETL) processes, thus ensuring that Excel users
can maintain an up-to-the-minute view of their data landscapes.
The essence of Python's indispensability lies in its ability to manage large
datasets, which often overwhelm Excel's capabilities. As datasets grow in
size, so do the challenges of processing them within the constraints of
Excel's rows and columns. Python, with its ability to handle big data,
enables users to process information that would otherwise be truncated or
slow to manipulate within Excel.
Moreover, Python's robust libraries, such as Pandas, offer data manipulation
and analysis functions that go well beyond the scope of Excel's built-in
tools. Users can perform complex data wrangling tasks, merge datasets with
ease, and carry out sophisticated statistical analyses—all within an
environment that is both powerful and user-friendly.
The introduction of machine learning and predictive analytics into the
business environment has further solidified Python's role as an essential tool
for Excel users. With libraries such as scikit-learn, TensorFlow, and
PyTorch, Excel users can now harness the power of machine learning to
uncover patterns and insights, predict trends, and make data-driven
decisions with a level of accuracy and foresight that was previously
unattainable.
Visualization is another realm where Python excels. While Excel offers a
variety of charting tools, Python's visualization libraries like Matplotlib,
Seaborn, and Plotly provide a much broader canvas to depict data. These
tools enable users to create interactive, publication-quality graphs and
dashboards that can communicate complex data stories with clarity and
impact.
Python's scripting capabilities allow for the customization and extension of
Excel's functionality. Through the use of add-ins and application
programming interfaces (APIs), Python can automate routine tasks, develop
new functions, and even integrate Excel with other applications and web
services, fostering a seamless flow of information across platforms and
systems.
In the context of 2024, where agility and adaptability are paramount,
Python equips Excel users with the means to refactor their approach to data.
It empowers them to transition from being passive recipients of information
to active architects of innovation. By learning Python, Excel users are not
just staying relevant; they are positioning themselves at the forefront of the
data revolution, ready to leverage the convergence of these two powerful
tools to achieve unprecedented levels of productivity and insight.
In the subsequent sections, we will explore the practical applications of
Python in Excel tasks, providing you with the knowledge and examples
needed to transform your spreadsheets into dynamic engines of analysis and
decision-making.
Setting Up Your Environment: Python and Excel
In the pursuit of mastering Python for Excel, the initial step is to establish a
conducive working environment that bridges both platforms. This section
will guide you through the meticulous process of setting up a robust Python
development environment tailored for Excel integration, ensuring a
seamless workflow that maximizes efficiency and productivity.
Firstly, you'll need to install Python. As of 2024, Python 3.12 remains the
standard, and it's important to download it from the official Python website
to ensure you have the latest version. This will give you access to the most
recent features and security updates. After installation, verify the setup by
running the 'python' command in your terminal or command prompt.
Next, let’s talk about Integrated Development Environments (IDEs). While
Python comes with IDLE as its default environment, there are numerous
other IDEs that offer enhanced features for development, such as PyCharm,
Visual Studio Code, and Jupyter Notebooks. Each IDE has its unique
advantages, and it's vital to choose one that aligns with your workflow
preferences. Jupyter Notebooks, for instance, is particularly favoured by
data scientists for its interactive computing and visualization capabilities.
With the IDE selected, you must install the necessary packages that
facilitate Excel integration. The 'pip' command, Python’s package installer,
is your gateway to these libraries. The most pivotal of these is Pandas,
which provides high-level data structures and functions designed for in-
depth data analysis. Install Pandas using the command 'pip install pandas' to
gain the ability to manipulate Excel files in ways that were previously
unimaginable within Excel itself.
To directly manipulate Excel files, you’ll also need to install the 'openpyxl'
library for handling .xlsx files, or 'xlrd' for working with .xls files. These
libraries can be installed with pip commands such as 'pip install openpyxl'
or 'pip install xlrd'.
Furthermore, to leverage Python's advanced data visualization tools, you
should install Matplotlib and Seaborn, essential for crafting insightful
graphical representations of data. These can be installed with 'pip install
matplotlib' and 'pip install seaborn' respectively.
For those who will be using Python alongside Excel’s macro capabilities,
the 'xlwings' library is a must-have. It allows Python to hook into Excel,
enabling the automation of Excel tasks and the creation of custom user-
defined functions in Python. Install it with 'pip install xlwings'.
Another critical aspect is the Python Excel writer 'xlsxwriter', which lets
you create sophisticated Excel workbooks with advanced formatting, charts,
and even formulas. It can be installed via 'pip install xlsxwriter'.
Once your libraries are installed, it's crucial to test each one by importing it
into your IDE and running a simple command. For example, you could test
Pandas by importing it and reading a sample Excel file into a DataFrame.
This verifies that the installation was successful and that you're ready to
proceed with confidence.
For those who may not be as familiar with command-line installations,
there are graphical user interfaces such as Anaconda, which simplifies
package management and provides a one-stop-shop for all your data science
needs.
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
The key differences between Python and Excel in functionality lie in their
unique strengths and use cases within data analysis. Excel, a spreadsheet
application, excels in data storage, manipulation, and simple analysis. Its
user-friendly grid interface is ideal for data entry and basic calculations.
However, it struggles with complex data processing and automation.
Python, a high-level programming language, excels in advanced data
manipulation, statistical modeling, and handling large-scale data. It
outperforms Excel in flexibility, scalability, and handling large datasets.
Python's extensive libraries enable sophisticated operations, like custom
machine learning models and web API integration, which Excel cannot
offer.
Python's advantage in handling large datasets is significant. It can process
much larger volumes of data compared to Excel's row limit. Python's
customization and automation capabilities surpass Excel's, especially with
its vast ecosystem of libraries.
Excel's formulas are convenient for simple tasks but become cumbersome
for complex analyses. In contrast, Python's syntax, though requiring more
learning, offers readability and maintainability, especially for complex
operations. Python also enables reusability and better organization of code
through functions and classes.
In visualization, Python has the upper hand with libraries like Matplotlib
and Seaborn, offering more variety and customization than Excel's built-in
chart types. Python's error handling is more robust, providing detailed error
messages aiding in debugging, unlike Excel's often challenging error
troubleshooting.
However, Excel's ease of use, familiar interface, and real-time collaboration
features make it irreplaceable for certain tasks, such as quick data entry and
pivot table use.
Integrating Python with Excel is made possible through several libraries,
enhancing Excel's capabilities with Python's analytical strength.

1. Pandas: Essential for data analysis, Pandas allows efficient data


manipulation and easy reading/writing of Excel files.
2. OpenPyXL: This library excels in creating and modifying Excel
.xlsx files, including automating complex file creation.
3. Xlrd and Xlwt: These are vital for handling older .xls files,
ensuring compatibility with legacy formats.
4. XlsxWriter: Focuses on creating Excel files with an emphasis on
formatting and presentation.
5. PyXLL: Integrates Python with Excel's UI, allowing Python
functions to be used as spreadsheet functions.
6. XLWings: Offers deep integration between Python and Excel,
including user-defined functions and Excel automation.
7. NumPy and SciPy: While not Excel-specific, they are
fundamental for numerical computations in Python.
For Excel users transitioning to Python, understanding core concepts is
crucial:

1. Variables and Data Types: These are fundamental in Python,


akin to Excel's cell values and formats.
2. Lists and Dictionaries: Python's data structures comparable to
Excel's rows, columns, and named ranges.
3. Control Structures: Python's if-else statements and loops
automate tasks, similar to Excel's conditional formulas.
4. Functions and Modules: These resemble Excel's custom
functions in VBA, allowing reusable code segments.
5. Exception Handling: In Python, this is akin to Excel's
IFERROR(), managing errors gracefully.
6. File Operations: Python's strength in file manipulation extends
beyond Excel's capabilities.
7. Object-Oriented Programming: Understanding this helps when
using complex Python libraries.
Mastering these concepts enhances Excel users' abilities to automate tasks,
handle larger datasets, and perform sophisticated analyses.

Python vs. VBA: A Deep Dive into Their Strengths and Weaknesses
Python's Superior Versatility and Performance Python stands out as a
high-level, versatile language with clear, intuitive syntax. Its broad
application range extends far beyond Excel, allowing for integration with
various databases and web applications, and excelling in complex statistical
analyses. Python's robust performance across different operating systems
and its efficiency in managing large datasets give it a significant edge over
VBA, especially for tasks surpassing Excel's row limits.
The Robust Ecosystem and Community of Python Python's ecosystem,
enriched with libraries like Pandas, NumPy, and Matplotlib, specifically
caters to data analysis and visualization, offering tools that are essential for
Excel users. The extensive and active Python community provides abundant
resources, documentation, and forums for support, overshadowing VBA's
more niche community.
VBA: The Comfort of Accessibility and Compatibility VBA, integrated
into Microsoft Office applications, offers immediate accessibility to Excel
users, eliminating the need for extra installations. Its direct interaction with
Excel sheets, forms, and controls makes it a convenient choice for small-
scale automation and tasks closely tied to Excel's interface.
Learning Curve and Development Time: A Balanced Perspective
Python might present a steeper learning curve for those without prior
programming experience, yet its syntax facilitates a smoother and quicker
learning process over time. VBA's specialized and less intuitive syntax can
make development faster for simple Excel tasks due to its in-app
integration.
Maintenance and Scalability: Python as the Future-Proof Choice
Python is easier to maintain and scale, with its readable code and cross-
platform functionality, contrasting with VBA's Windows and Microsoft
Office limitations. Python's broader applicability makes it more future-
proof and scalable.
Security and Updates: Python's Progressive Edge Python continuously
integrates the latest security features and best practices, while VBA, as an
older language, may fall short in modern security standards. Microsoft's
increasing investment in Python for Excel indicates Python's growing
preference for future developments.
Python's Extensive Integration Capabilities Python's ability to connect
with various data sources, APIs, and services far surpasses VBA's
integration, mainly confined to Microsoft Office applications. This
capability is crucial for those aiming to broaden their data processing scope.
Conclusion: Python vs. VBA for Excel Users While VBA remains
suitable for straightforward, Excel-focused tasks, Python emerges as the
more powerful, versatile, and forward-looking option. Despite an initial
learning curve, Python's advanced data handling and analysis capabilities
make it an invaluable asset for Excel users seeking to excel in a data-driven
world.
Pandas: A Vital Tool for Data Manipulation in Python
Transitioning to data mastery with Python, one encounters Pandas, a key
library for enhancing data manipulation in conjunction with Excel. This
section explores Pandas' fundamentals and its transformative potential for
data work.
Understanding Pandas: A Data Analysis Catalyst Pandas, born from the
needs of data analysts, is a Python library offering structures and operations
for handling numerical tables and time series. Its name, derived from "Panel
Data," reflects its focus on handling structured, multidimensional data sets.
DataFrames: Pandas' Core Feature The DataFrame, akin to an advanced
Excel spreadsheet, is a mutable, two-dimensional data structure with
labeled axes, capable of processing millions of rows effortlessly. This
feature is central to Pandas' role in data manipulation.
Mastering Data Manipulation with Pandas Pandas streamlines tasks like
merging datasets, pivoting tables, and managing missing data, surpassing
Excel's capabilities. Its I/O functions allow for smooth interaction with
various file formats, enhancing Excel's functionalities.
Sample Pandas Code for Excel Users
python
import pandas as pd

# Read Excel file


df = pd.read_excel('financial_data.xlsx')
# Filter data based on 'Revenue' criteria
filtered_df = df[df['Revenue'] > 10000]

# Export filtered data to a new Excel file


filtered_df.to_excel('filtered_financial_data.xlsx', index=False)
This code exemplifies Pandas' efficiency in performing tasks that are more
complex in Excel.
Advanced Data Transformation with Pandas Beyond basic
manipulation, Pandas offers sophisticated functions for complex data
transformations, including groupby operations, time-series analysis, and
custom lambda functions, enhancing data manipulation granularity.
The Excel to Pandas Transition For Excel users, moving to Pandas
represents a significant upgrade in data handling capabilities. Pandas
addresses Excel's limitations with large datasets and repetitive tasks,
opening doors to advanced data analysis techniques.
Pandas in the Data Ecosystem Pandas is a component of a broader data
toolkit, integrating seamlessly with libraries like NumPy and Matplotlib,
forming a comprehensive toolkit for any data analyst.
In summary, Pandas is not just a library, but a gateway to advanced data
manipulation, empowering Excel users to manage larger datasets, perform
faster analyses, and achieve more accurate results. The upcoming sections
will delve deeper into Pandas' capabilities, equipping you to revolutionize
your approach to data analysis with Python and Excel.
Transitioning from Excel to Python: Practical Advice
Moving from Excel to Python can be both exciting and challenging. This
segment offers practical tips to smooth the transition from a graphical
interface to a scripting language.
Adopting a Pythonic Mindset The transition starts with embracing
Python's philosophy, which emphasizes readability, simplicity, and
explicitness. Familiarize yourself with Python's syntax and conventions,
and start thinking in terms of automation, reusability, and scalability.
Using Excel as a Bridge Utilize your Excel skills as a foundation. Many
Excel concepts have Python parallels, like Excel formulas corresponding to
Python functions. This familiarity can make learning Python's data
manipulation tools more approachable.
Structured Learning Approach Develop a structured learning plan. Start
with Python basics, then explore data-specific libraries like Pandas and
NumPy. Focus on understanding data structures, control flows, and
functions, before delving into data manipulation and visualization.
Learning by Doing Practical application is key. Translate simple Excel
tasks into Python, writing scripts for routine data processing. This hands-on
approach solidifies understanding and builds confidence.
Sample Python Script for Excel Users
python
# Define a list of prices
prices = [100, 200, 300, 400]

# Apply a discount and calculate the total


discount_factor = 0.9
discounted_prices = [price * discount_factor for price in prices]
total = sum(discounted_prices)

print(f"Total after discount: {total}")


Utilizing Online Resources and Community Leverage online resources
like tutorials, forums, and coding communities. Engage with the Python
community for guidance and shared experiences.
Exploring IDEs and Integration Tools Get acquainted with Integrated
Development Environments (IDEs) like PyCharm or Visual Studio Code,
which offer features enhancing productivity.
Building a Project Portfolio Apply Python skills to real-world projects,
documenting them in a portfolio to track progress and showcase abilities.
Patience and Persistence Be patient and persistent. Learning a new skill
takes time, and every challenge is a learning opportunity.
Staying Updated and Adaptable Keep up with Python's evolving
landscape. Stay adaptable to incorporate new tools and techniques.
Transitioning from Excel to Python opens up new potentials for data
analysis and automation. By embracing Python's principles, leveraging
Excel knowledge, and applying skills to practical problems, you'll soon
master a language at the forefront of modern data science, embarking on a
new chapter in your analytical journey.
Setting Ambitious Goals with Python and Excel Integration
Integrating Python with Excel equips you with a potent toolkit, synergizing
Python's programming capabilities with Excel's spreadsheet functionalities.
This section outlines ambitious goals achievable through this powerful
combination.
Enhanced Data Analysis and Automation One primary goal is to boost
your data analysis capabilities using Python's libraries like Pandas and
NumPy, facilitating the handling of large datasets and tasks challenging in
Excel. Automate repetitive tasks with Python scripts, transforming manual
processes like data cleaning and report generation into efficient, automated
operations.
Advanced Data Visualization and Real-Time Data Feeds Python extends
Excel's data visualization tools with libraries like Matplotlib, Seaborn, and
Plotly, enabling sophisticated, interactive visualizations. Set up automated
data pipelines with Python to maintain real-time data feeds in Excel,
eliminating manual data imports.
Machine Learning and Predictive Analytics Leverage Python's machine
learning libraries like scikit-learn to build predictive models, and use Excel
for analyzing and presenting model outputs. Apply this to sales forecasting,
customer behavior analysis, and other predictive applications.
Custom Excel Functions and Efficient Collaboration Develop custom
Excel functions using Python, bridging Excel's simplicity with Python's
functionality. Enhance collaboration features with Python's networking
capabilities, ensuring effective team coordination with up-to-date data.
Building Scalable Data Processing Pipelines Aim to construct a scalable
data processing pipeline encompassing data ingestion, processing, and
output generation, integrating error handling, logging, and performance
optimizations.
Expanding Career Opportunities Python and Excel proficiency broadens
career prospects, positioning you for roles like data analyst, financial
modeler, or business intelligence expert.
Empowering Decision-Making Ultimately, integrating Python with Excel
aims to empower decision-making with advanced analysis techniques,
providing deeper insights and more accurate forecasts.
Embrace this journey as a continuous learning process. Each milestone
paves the way for more complex, rewarding projects, pushing the
boundaries of data analysis and automation. Let your ambition guide you to
new heights of analytical prowess with Python and Excel.
CHAPTER 2: PYTHON
BASICS FOR
SPREADSHEET
ENTHUSIASTS –
ENHANCED
Advanced Data Types in Python
for Excel Users

I
n the dynamic world of data management and analysis, a deep
understanding of data types forms the cornerstone. As we embark on a
journey through Python's landscape, recognizing and utilizing its diverse
data types becomes imperative. This becomes particularly salient when
contrasting these with Excel's familiar data types. This section aims to serve
as a comprehensive guide, bridging the gap between Python and Excel data
types, facilitating a seamless transition for those adept in Excel delving into
the Python domain.

Python's data types form the backbone of its versatility. Beginning with the
essentials: integers, floats, strings, and booleans – these are crucial. A
Python integer is comparable to Excel's whole number, sans decimal points.
Floats in Python are akin to Excel's numbers with decimals. Python's strings
are character sequences, mirroring Excel's text format. Booleans in Python
are essential, representing binary truth values – True or False, analogous to
Excel's logical TRUE and FALSE.

Excel aficionados typically organize data using rows and columns. Python
introduces lists and tuples for storing ordered data collections. Lists are
dynamic, allowing post-creation modifications, while tuples remain static.
Envision lists as Excel rows or columns, permitting value alterations or
additions. Tuples resemble a constant set of Excel cells.

Python's dictionaries resemble Excel's two-column tables, with unique keys


in the first column and corresponding values in the second. These
dictionaries facilitate rapid data retrieval and storage, akin to Excel's
VLOOKUP or INDEX-MATCH functions for data associated with unique
identifiers.

Python also presents sets, unique item collections. Imagine an Excel


column devoid of duplicates – sets automatically remove redundancies,
proving beneficial for Excel users frequently dealing with duplicate
removal.

Transitioning from Excel to Python primarily involves acclimatizing to


DataFrames, courtesy of the Pandas library. These DataFrames mimic Excel
worksheets, offering a two-dimensional data structure with rows and
columns, enabling operations akin to Excel but with enhanced power and
efficiency.

Grasping these data types is critical as they govern Python's data


manipulation and analysis capabilities. For instance, understanding the
impossibility of performing mathematical operations on strings, or the
immutable nature of tuples versus the modifiable lists, is vital when
scripting Python interactions with Excel data.

In practice, transitioning data between Excel and Python entails mapping


Excel's data types to Python's equivalents. This is pivotal when importing
data into Python for analysis or exporting it back into Excel for
presentation. A profound understanding of these data types not only eases
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Exploring the Variety of Random
Documents with Different Content
Nearly an hour passed. Then Montgomery came back radiant.
"It's all fixed," he said. "You make your début to-morrow evening. I
have engaged board at the hotel for us both."
CHAPTER XXIII.
DEAN'S DEBUT.

The next morning the Granville Weekly Palladium appeared,


containing a flaming notice of the forthcoming entertainment, in
which the merits of the two performers were extolled in the highest
terms. Dean opened his eyes in amazement when he read the
following tribute to himself:
At immense expenses the service of

DEAN DUNHAM

the Champion Harmonica player of America have been secured. This


young performer, still only a boy in years, will spend the next season
in Europe, having been offered engagements in London, Paris and
Vienna, and he is now playing a farewell series of engagements in
his native land. Probably the citizens of Granville may never again
have the opportunity of hearing him.
"What do you say to that, Dean, my boy?" asked Montgomery,
nudging him in the side.
"It makes me feel foolish, Mr. Montgomery," said Dean, blushing.
"If it should be read in Waterford the people would never get
through laughing at me."
"They won't read it, my boy, unless it turns out true."
"Turns out true?"
"Yes. I believe you can win popularity by your playing. We can
tell better this time to-morrow. If you do, how can we tell but the
rest may also come true?"
"If it were the violin or the banjo! But a little cheap harmonica!"
"Never mind what the instrument is if you know how to handle
it. Now let me tell you one thing that will encourage you: I think we
are going to have a big house."
"What makes you think so?"
"There hasn't been an entertainment in Granville for several
weeks. The people are hungry to be amused. They patronize
performances like ours much better in the West than at the East.
There the people are more humdrum and steady going. Here they
are more excitable. Now I am going to give you a hint. Take a walk
out into the woods, or anywhere where you will be alone, and
practice popular songs. I want you to make a sensation this
evening."
"It seems ridiculous, my playing for money!"
"How much money have you in your pocket?"
"Five cents."
"Then it strikes me it would be more ridiculous not playing for
money. Whatever talents we possess our Creator meant us to
exercise for our benefit and the pleasure of the community."
"At any rate I'll do my best."
"Then you'll do all I ask. By the way, I am going to have you
take the tickets this evening, up to the time of the performance. It
will save money, and draw public attention."
"I can do that, at any rate."
During the forenoon Dean went to a secluded place a mile from
the village, and began to practice on the harmonica. He had a quick
ear, and was really an excellent performer. He was unaware that he
had an audience till a boy attracted his attention peeping from
behind a tree at a little distance.
Dean nodded and smiled, and the boy was encouraged to come
forward.
"Are you Dean Dunham, the boy that's going to be at the
concert?" asked the young auditor, bashfully.
"Yes."
"How long have you played?"
"Four or five years."
"How old are you?"
"Almost sixteen."
"What lots of money you must have made!"
Dean smiled. He thought it most prudent not to speak definitely
on this point. He was rather curious to know what the boy thought
of his playing.
"Can you play on the harmonica?" he asked.
"Only a little. Of course I can't play like you."
"Do you like my playing, then?"
"You play bully."
Dean was gratified, not so much out of vanity, as because it
encouraged him to think that others also might regard his
performance with favor.
"I am glad you like it," he said. "Are you going to the
entertainment this evening?"
"I should like to," said the boy, wistfully, "but I don't have much
money to spend. I have to work for a living."
"He little thinks that I am worse off than he," thought Dean. "He
has a home, while I am over a thousand miles from mine, and with
only five cents in my pocket."
"It won't cost you anything to come in," he said in a friendly
manner. "I shall be at the door, and I will let you in free."
"Will you, really?" queried the boy, overjoyed.
"Certainly I will. I shall remember your face. If I don't, just
remind me of my promise."
As a matter of business, Dean's offer of a free ticket proved a
stroke of policy. The boy spread among his comrades a highly
colored report of Dean's wonderful performance on the harmonica,
and the result was a large attendance of young people in the
evening.
When Dean took his place at the door he found himself the
object of many wondering and curious glances, and he was at first
abashed; but finally, reminding himself that he was among strangers
who were disposed to look upon him as a genius, he accommodated
himself to the position, and applied himself assiduously to his duties.
The hall in which the entertainment was to take place contained
about four hundred people. When eight o'clock struck it was packed,
many having come from neighboring towns. The price of admission
was thirty-five cents for adults, and twenty-five for children. It was
clear, therefore, that the receipts must be considerably over a
hundred dollars. The rent of the hall being but ten dollars, this
allowed a large margin for profit.
Punctually at eight o'clock the entertainment commenced with a
brief introductory speech from Mr. Montgomery.
"Gentlemen and ladies," he said, "it has long been the desire of
Mr. Dunham and myself to appear in your beautiful village, and at
length our wishes are to be gratified. We shall do our utmost to
please you, and if we fail, think that it is our ability and not our will
that is lacking. I will commence with a humorous recitation, in the
character of an old darky."
He disappeared behind the screen, and emerged in a very short
time disguised as a Southern negro.
This impersonation hit the popular taste. It was followed by a
song, and then Mr. Montgomery introduced Dean in a highly
flattering manner.
Dean appeared with a flushed face, and a momentary feeling of
trepidation. Making a bow to the audience, he struck up the favorite
melody of the day. He really played very well, the excitement of
playing before an audience helping rather than interfering with him,
and his performance was greeted with hearty and long continued
applause. At Mr. Montgomery's suggestion he gratified the audience
with an encore. Among those who applauded loudest was the boy to
whom he had given free admission.
"You have done yourself proud, Dean, my boy," said
Montgomery, when Dean retired behind the screen. "Our
entertainment is a success. Our audience is good-natured."
"I can't help thinking how the folks at home would be surprised
if they knew I was performing in public," said Dean, smiling.
"And making money out of it. That's where the best part comes
in. Follow up your success, my boy. I shall go out twice and then call
on you again."
The next time Dean appeared with confidence, being satisfied
that the audience were friendly. His second appearance was equally
satisfactory, and he was compelled to blush when he overheard one
school-girl on the front row of benches whisper to another, "Isn't he
sweet?"
"It seems to me I am learning a good deal about myself,"
thought Dean. "I must take care not to get conceited."
The dual entertainment lasted about an hour and a half, Mr.
Montgomery of course using up the lion's share of the time. At last it
concluded, and Dean and his companion gathered up the money and
went home. The profits over and above expenses amounted to
eighty dollars, of which the editor, according to the agreement,
received forty per cent, or thirty-two dollars. The remainder, forty-
eight dollars, was divided equally between Dean and Mr.
Montgomery. As the hotel charge was but a dollar a day for each,
they felt handsomely compensated for their exertions.
CHAPTER XXIV.
DEAN LOSES HIS PARTNER.

When the two partners returned to the hotel with the proceeds
of the entertainment in their pockets, they were in high spirits.
"I feel as rich as Vanderbilt," said Montgomery in exultation.
"And I feel like an Astor or a Gould," chimed in Dean. "Peter
Kirby did me a good turn when he discharged me."
"Dean, you are star! I had no idea of your talent."
"Don't flatter me, Mr. Montgomery," said Dean blushing. "You will
make me self-conceited. I was lucky in falling in with you."
"Well said, my boy! I see you don't grudge me my share of the
credit. We will keep on, will we not?"
"As long as there is any money in it."
"Precisely. Your hand on that."
In pursuance of this agreement, three evenings later they gave
an entertainment in the town of Cameron, twenty miles away.
Circumstances were not as favorable, but they divided twenty dollars
net profits.
"We mustn't complain of that, Dean," said his companion. "It
isn't as much, to be sure, as we made at Granville."
"But it seems to me ridiculously large for the little I did, Mr.
Montgomery."
"You are modest, Dean. That is not artistic. You must set a
proper value on your talent."
"I think I do," said Dean, smiling. "I feel very much like a
humbug, Mr. Montgomery. A young lady came up to me last evening
and asked me if I had played before any of the crowned heads of
Europe, and if I were personally acquainted with Queen Victoria."
"I hope you told her you were."
"No, Mr. Montgomery, I shouldn't be willing to tell such a
falsehood."
"All business, my dear boy, all business! We must blow our own
trumpets if we want to be appreciated. By the way, what did you tell
her?"
"That I had not yet played before the queen, but should I go to
England, and could arrange to do so, I would."
"Very good! You kept up appearances. What did she say?"
"She asked me if I would get her Queen Victoria's autograph, in
that case. She also asked me for my own. I promised her the
queen's if I were able to obtain it."
"Didn't she ask for my autograph?" asked Mr. Montgomery, with
a twinge of professional jealousy.
"She said she was going to ask you for it."
"I shall be glad to gratify her," said Montgomery,
condescendingly. "I am often asked for an autograph."
"That was my first application," said Dean smiling.
"You are not as old as I. Long before you are, your autograph
will be in demand."
For three weeks the combination continued to give
entertainments, arranging from two to three a week. They did not
again meet with the success which had greeted them at Granville,
but in almost every case they made expenses, and a fair sum
besides. At the end of this time, each of the partners found himself
possessed of about forty dollars.
At the close of a concert at a small town in Missouri, on
returning to the hotel, Mr. Montgomery chanced to take up a copy of
the New York Herald in the office. He ran over the advertisements on
the first page, including the "Personals," when all at once his color
changed, and he looked agitated.
"What's the matter, Mr. Montgomery?" asked Dean.
"Bad news, my boy!" said the actor sadly. "Look at that!"
Dean read the following among the personals:

C ECIL MONTGOMERY, Jr. Come home at once! Your


mother is very sick.

"My poor old mother!" said the actor feelingly. "She may be dead
by this time. Why couldn't I have seen this notice before?"
"What is the date of the paper?" asked Dean.
"It is five days old."
"I suppose you will go at once."
"Yes, I must. I never would forgive myself if I did not hurry
home on the chance of seeing the dear old mother once more."
"You are right, Mr. Montgomery. I would do the same if I were
fortunate enough to have a mother living."
"Of course that ends our partnership for the present. Will you go
home with me, Dean?"
Dean shook his head.
"No, I have nothing to go home to. It would take all my money,
and there would be nothing for me to do in Waterford."
"But you can't give entertainments alone."
"I can make my living somehow. I have forty dollars, and that
would last me some time even if I got nothing to do."
When Dean bade his companion good-bye at the station the
next morning, and turned away, a forlorn feeling came over him, and
he felt tempted to take the next train East himself. But the thought
of going back to Waterford as poor as he started, and with no
prospect of employment, braced him up, and he resolved to push on
westward and take his chances. He returned to the hotel, and sat
down to consider his plans.
There a pleasant surprise awaited him.
"There's a gentleman to see you, Mr. Dunham," said the clerk.
"Where is he?" asked Dean.
"He went out to make a call in the village but will be back in
fifteen minutes. This is his card."
Dean took the card in his hand, and read the name
Samuel Gunnison.
"Any acquaintance of yours?" asked the clerk.
"No; I never heard the name."
"I think he wants you to play to-morrow evening. He lives in the
next town, Carterville."
"Mr. Montgomery has been called East. I am afraid this will stop
our entertainments."
"He did not ask for Mr. Montgomery, only for you."
Mr. Gunnison soon came in. He was a slender, dark
complexioned man, with a pleasant face.
"I know you are Dean Dunham," he said, extending his hand,
"for I heard you play last evening. Are you engaged for to-morrow?"
"No, sir."
"Then I should like to engage your services. An entertainment is
to be given in our town hall for the benefit of our town library. For
the most part local talent is employed. We are to have a short play,
and a few songs. I, as manager, have thought it would help us if we
could advertise you in connection with the home attractions."
"I shall be glad to make an engagement," said Dean pleasantly.
"What would be your terms?" asked Mr. Gunnison a little
anxiously.
"How much can you afford to pay me?" asked Dean.
"We would not think of offering a player of your reputation less
than ten dollars if it were not desirable to make expenses as small as
possible, but——"
"Under the circumstances," said Dean, interrupting him, "I will
be willing to come for five."
"Thank you, Mr. Dunham. You are very kind," said Mr. Gunnison,
warmly, grasping our hero by the hand. "I will try to make it up to
you. Instead of going to the hotel you shall be my guest, and your
expenses will be nothing. If you are ready I will take you over at
once. I have a buggy at the door."
"Thank you, sir, I will accept your kind invitation."
So Dean, feeling less lonesome than he did, secured his valise,
and taking a seat beside his new friend, rode in the direction of
Carterville. He was destined to meet an old acquaintance there.
CHAPTER XXV.
AN UNEXPECTED MEETING.

Mr. Gunnison had several children, including one boy of about


Dean's age, who was disposed at first to regard our hero with
distant respect as a professional star, but soon became intimate with
him on finding that Dean had the same tastes as himself. This
appeared to surprise him.
"I say," he remarked, "I thought you wouldn't have anything to
say to a fellow like me."
"Why not?" asked Dean, innocently.
"Oh, because you're a big gun."
"How's that?"
"You give concerts, and have your name in the papers."
"Oh!" said Dean smiling, "I have to do that for a living, you
know. I'm only a boy after all."
"And do you like to play baseball?"
"I only wish I had a chance."
"Do you?" said Gus Gunnison, brightening up. "Well, our club is
going to play the Resolutes from the next town this afternoon. We
are one man short. Will you take his place?"
"Yes, I shall be glad to."
"What place do you prefer?"
"I'll take any you choose to give me."
"Can you catch?"
"I like it better than anything else."
"Then that's settled. Come over and I'll show you the ground,
and introduce you to some of the fellows."
When the members of the Carterville club learned that the
famous young musician, Dean Dunham, had agreed to play on their
side, they were very much elated. There was, however, a slight
uneasiness lest he should not prove a skillful player, as they were
eager to beat their visitors. A little practice playing, however, showed
them that Dean was quite equal to any one in their club, and they
became eager for the fray.
Dean did not disappoint them. He entered into the game with
enthusiasm, and played with unusual skill, so that the Resolutes
were beaten by a score of 18 to 8, and the victory was largely
attributed to the good playing of the new catcher, who proved
equally good in batting.
The members of the club came up and tendered their thanks to
Dean.
"If you can play on the harmonica as well as you can play ball,"
said Gus Gunnison, "you'll do. Our club will attend the entertainment
in a body, and hear you."
"I hope you won't be disappointed," said Dean smiling.
Evening came, and Dean was called upon to play at four
different points in the entertainment. On the front seats just facing
him were the members of the Active Baseball Club. Dean nodded to
them from the platform, and they felt proud of such a public
recognition.
Dean was stimulated to do his best, as he did not wish his new
friends to be disappointed. During the day he practiced "Home,
Sweet Home" with variations, partly original, partly remembered
from a performance to which he had listened at a public
entertainment a year or two previous. His efforts were crowned with
success. The applause, led by the members of the Active club, was
tumultuous, and Dean was compelled to repeat his performance.
He did so, but towards the close he nearly broke down in
consequence of a surprising discovery that he made. In looking
round the audience, not far from the center aisle his glance chanced
to fall upon a face which he had the best cause to remember.
It was no other than Mr. Peter Kirby, whose presence will be
afterwards explained.
Mr. Kirby on his part was even more amazed to find the country
boy whom he had left to his own resources emerging in such a
conspicuous manner into public notice. He had thought of Dean as
wandering about the country a forlorn and penniless tramp, begging
for charity. How on earth he had managed to achieve the position of
a musical star performer he could not imagine.
"That boy is getting dangerous," thought he. "If the captain
knew of his success he would feel very nervous."
Mr. Kirby was in Carterville as the guest of Dr. Sidney Thorp, a
wealthy gentleman, into whose good graces he had ingratiated
himself at a hotel where they chanced to meet. He had accepted Dr.
Thorp's invitation to spend a couple of days at his house, with the
intention of robbing his hospitable entertainer if he should have the
opportunity.
"A remarkable young performer!" said Dr. Thorp, as Dean closed
his playing.
"Yes," assented Kirby absently. "How does he happen to be
here?"
"He had been giving an entertainment in a town near by, in
connection with a variety actor. Our committee, finding that he gave
satisfaction, invited him to play here this evening."
"Do you pay him anything?"
"Certainly," answered Dr. Thorp, with surprise. "We couldn't
expect to obtain a performer of so much talent gratuitously."
Kirby opened his eyes in surprise at hearing his quondam
secretary spoken of in such terms.
"Do you know how much he is to be paid?"
"I believe he agreed to come for five dollars, considering that
the entertainment was for a charitable purpose."
Kirby could scarcely refrain from whistling, so great was his
surprise.
He recognized Dean some time before his former secretary's
glance fell upon him. Dean's start showed that the recognition was
mutual.
"I am going to speak to this boy—Dean Dunham," said he to Dr.
Thorp, when the entertainment was at an end.
"Mr. Gunnison will introduce you. Shall I ask him?"
"I need no introduction. The boy and I have met."
Dean was standing on the platform watching the departing
audience, when he saw Mr. Kirby approaching. He felt a little
nervous, not knowing what the intentions of his old employer might
be.
Kirby paused a moment, and a peculiar smile overspread his
countenance.
"I presume you remember me?" he said.
"Yes," answered Dean, coldly.
"I am rather surprised to meet you again under such
circumstances."
"I am rather surprised myself—at the circumstances."
"You have become quite a star!" said Kirby with a sneer.
Dean answered gravely, "I had to make a living in some way. It
was an accident, my trying this way."
"Would you like to return to me—as my secretary?"
"Thank you, Mr. Kirby, I prefer to travel independently."
"Suppose I should tell why I discharged you? That might prove
inconvenient to you."
"Then I should have a story to tell that might prove inconvenient
to you, Mr. Kirby."
Dean looked Kirby straight in the face, and the latter saw that he
no longer had an inexperienced country boy to deal with, but one
who might prove dangerous to his plans.
"On the whole," he said, after a pause, "suppose we both keep
silence as to the past."
"I will do so, unless I should have occasion to speak."
No one was near enough to listen to this conversation. Now Dr.
Thorp came up, and Kirby said with an abrupt turn of the
conversation, "I am glad to have met you again, my young friend. I
wish you success."
Dean bowed gravely, but didn't speak. He was not prepared to
wish success to Peter Kirby, knowing what he did of him.
During the evening Dr. Thorp called at the house of Mr.
Gunnison, but unaccompanied by his guest. Dean had heard
meanwhile at whose house Kirby was staying, and he felt that he
ought to drop a hint that would put the unsuspecting host on his
guard. He finally decided that it was his duty to do so.
"May I speak with you a moment in private, Dr. Thorp?" he
asked, as the guest arose to go.
"Certainly," answered the doctor, in some surprise.
Dean accompanied him into the hall.
"Do you know much of the gentleman who is staying at your
house?" asked Dean.
"No; why do you ask?"
"Because I have reason to think that he is a professional thief."
"Good Heavens! What do you mean!"
Dean briefly recounted the robberies of which he was himself
cognizant, adding that he gave this information in strict confidence.
"I thought I ought to put you on your guard," he concluded.
"Thank you, Mr. Dunham," said Dr. Thorp, warmly. "You have
done me a great service. I happen to have a considerable sum in
money and bonds at my house. I shall look out for Mr. Kirby," he
added, with a grim nod.
CHAPTER XXVI.
DR. THORP'S CABINET.

Dr. Thorp had been pleased with Peter Kirby, who had laid
himself out to be agreeable, and the doctor was far from suspecting
his real character. When this was revealed to him by Dean, he
quickly decided to test it for himself.
Some men, inclined to be nervous and timid, would have had
their apprehensions excited, and dreaded an encounter with a
professional criminal. But Dr. Thorp was cool, resolute and
determined. He proposed to facilitate Kirby's designs, and catch him
in a trap.
When he reached home he found Kirby smoking on the piazza.
"Have you been taking a walk, Doctor?" he asked.
"Yes," answered Dr. Thorp. "I made a call on a neighbor. I hope
you have not been lonesome."
"Oh, no! Your daughter has enabled me to pass the time
pleasantly. But I am glad to see you back."
Had Kirby known that Dr. Thorp had had an interview with Dean
Dunham, his anxiety would have been excited.
"By the way, Doctor," said Kirby with apparent carelessness, "I
have a little money to invest. Can you recommend any form of
investment?"
"You might buy a house in the village and settle down. I believe
the next estate is for sale."
"It would certainly be an inducement to become your neighbor,"
said Kirby politely, "but I am a rolling stone. I am always traveling. I
couldn't content myself in any one place, not even in a large city."
"I suspect your mode of life makes frequent removals
necessary," thought Dr. Thorp, though he did not say so.
"Well, if you don't care to invest in real estate," he said a
moment later, "you might purchase government bonds or railroad
securities."
"To which do you give the preference?" asked Kirby.
The doctor smiled inwardly. He saw that Kirby was trying to
ascertain whether he had any negotiable securities in his possession,
but he was ready to play into his hands.
"Well," he said, "I think well of both."
"I had some government bonds at one time," said Kirby, "but
they were stolen. That has made me cautious."
"Perhaps you were careless."
"No doubt I was. I kept them in a trunk at my boarding-house. I
presume you wouldn't venture, even in a quiet village like this, to
keep bonds in your house?"
"Oh, yes, we never receive visits from thieves or burglars. I don't
consider trunks so safe as—that cabinet."
He pointed to a black walnut cabinet with several drawers
standing in one corner of the room.
Kirby's face lighted up. He had got the information he desired,
but he resumed his indifferent manner.
"I think you are right," he said. "Besides, in a town like
Carterville, as you say, thieves are hardly likely to be found."
"Oh, dear, no!" said Dr. Thorp yawning. "I have no occasion to
borrow trouble on that score."
"Living as I generally do in large cities where members of the
criminal class abound," said Kirby, "I am naturally more suspicious
than you. I confess I wish I lived in a place of Arcadian innocence
like this."
Dr. Thorp smiled. He was amused to hear one whom he believed
to be a professional thief discourse in this manner.
"You might find it dull," he said, a little satirically, "It would lack
the spice and excitement of wickedness."
At a little after eleven Kirby signified that he was tired and was
conducted to his bed-chamber. Dr. Thorp remained behind, and
opening the lower drawer of his cabinet removed therefrom a roll of
bank bills and a five hundred dollar government bond.
"I think these will be safe in my trunk to-night," he said to
himself. "Now, Mr. Kirby, you can explore the cabinet at your leisure.
I doubt if you will find enough to repay you for your trouble."
Kirby occupied a chamber just over the sitting-room. He didn't
undress himself, but threw himself on the bed to snatch a little rest.
"I found out very cleverly where the doctor kept his bonds," he
soliloquized. "He is an innocent, unsuspicious man, luckily for me. So
no thieves or burglars ever visit Carterville," he repeated with a soft
laugh. "The good doctor would have been mightily surprised had he
known the character of the man with whom he was talking. It is
hardly a credit to take in a simple-minded man like the doctor. I very
much regret the necessity of repaying his hospitality as I shall, but I
need the bonds more than he does."
Kirby did not allow himself to sleep. There was important work
to be done, and he must not run the risk of oversleeping himself.
He waited impatiently till he heard the public clock strike
midnight, then taking off his shoes descended in his stocking feet to
the sitting-room. There stood the cabinet plainly visible in the
glorious moonlight that flooded the room, making artificial light
unnecessary.
"It's an easy job for a man of my experience to open it," thought
Kirby. "I hope the doctor is sound asleep. He looks like a man who is
safe to sleep all night."
From his pocket he produced a bunch of skeleton keys, which he
at once set himself to use. The lock on the drawer of the cabinet
was a simple one, presenting no difficulty, and in less than five
minutes he opened the upper drawer. A glance satisfied him that it
contained nothing that he could make available. In turn he opened
the other drawers, with equal ill success.
"The doctor must have fooled me!" he muttered impatiently, "or
is there some secret drawer that I have overlooked?"
This question he asked himself, but he was far from expecting
an answer.
"You have examined the cabinet pretty thoroughly Mr. Kirby,"
said a cool, calm voice.
Kirby sprang to his feet in wild dismay. There, looking at him
from the doorway, was Dr. Thorp, his host, whom he was conspiring
to rob.
"You are an early riser, are you not, Mr. Kirby?" said the doctor
composedly.
Kirby quickly decided upon his course.
"Where am I?" he asked, passing his hand over his face in a
bewildered way.
"Where are you? Don't you recognize the room? A more
pertinent query would be, 'What are you doing?'"
"Good Heavens!" ejaculated Kirby—"I—I see it now. That
unfortunate habit of walking in my sleep! What can you think of
me?"
"Do you generally carry skeleton keys about with you when you
walk in your sleep, Mr. Kirby?" asked the doctor pointedly.
"I—I really don't know how to explain," stammered Kirby. "These
keys I found in my room on the morning after I was robbed. I took
them with me, thinking they might be of use if I should lose my
regular keys."
"Very ingeniously explained, upon my word!"
"It isn't possible, Dr. Thorp, that you really take me for a thief! I
hope you have more confidence in me."
"Well, it really did occur to me that you were a professional
burglar. Your last words which I overheard before intruding upon you
seem to bear out that supposition."
"What were they?"
"'Is there some secret drawer that I have overlooked?' Perhaps
you will do me the favor to explain them."
"I can't. They were spoken unconsciously, I assure you. This
habit of walking in my sleep has got me into trouble several times
before."
"Then take my advice and discontinue it."
"I will. I should have asked you to lock me in my chamber if I
could have foreseen what has happened."
"Mr. Kirby," said Dr. Thorp sternly, "you must think I am a
simpleton to be taken in by such a transparent falsehood. I was
deceived in you, I admit, but now I understand your real character. I
won't have you arrested, though I ought, but I require you to leave
my house at once."
"In the middle of the night?" said Kirby in dismay.
"Yes. I cannot agree to shelter you even for the balance of the
night."
"Tell me one thing," said Kirby, changing his tone; "did any one
put you on your guard against me?"
"Yes."
"It was Dean Dunham."
"You can form your own conclusions."
"That is all you need tell me. I understand it all. I will go to my
room and secure my luggage, and then bid you good-bye."
"I will wait for you."
"I owe you another debt, Dean Dunham!" said Kirby, as he left
the house with the pleasant prospect of a sleepless night.
CHAPTER XXVII.
THE LONELY CABIN.

Dean had left the breakfast-table the next morning, and was
considering what would be the next stage of his journey when Dr.
Thorp was announced.
"Mr. Dunham," he said, "I have come to thank you for your
warning of last evening."
"I hope it was of service to you, sir."
"It was of essential service. Your old acquaintance had planned
to rob me of a sum of money and a quantity of government bonds,
but being on my guard I was able to frustrate his designs."
"How did it happen?" asked Mr. Gunnison, his curiosity excited.
"In the middle of the night, or rather a little after midnight, I
heard some one going downstairs softly. I followed unobserved, and
caught my guest opening the drawers in my cabinet."
"Where is he now?"
"I ordered him out of the house. He stood not upon the order of
his going, but went at once. Where he is now I cannot inform you,
but presume he has placed several miles between himself and
Carterville. Fortunately he went empty-handed, and my money and
bonds are still in my possession. But for our young friend here I
should hardly be able to say that."
"You are indebted to me for bringing him to Carterville, Dr.
Thorp," said Mr. Gunnison in a jocular tone. "How much are you
going to allow me?"
"You are amply repaid by his services," said the doctor, "judging
from the comments I have heard upon his performance. I am under
obligations to him, however, which I ought to acknowledge. Mr.
Dunham," he continued, taking from his pocket a small gold watch
and chain, "I see you have no watch. Please accept this with my
best wishes."
It was an Elgin gold watch of neat pattern which he offered to
Dean.
"It is not quite new," proceeded the doctor. "I bought it of a
young man in need of money, and having paid him its full value I
have no scruple in giving it away."
"Thank you very much," said Dean, his face showing the
satisfaction he felt. "I have felt the need of a watch ever since I
began to travel, but never dreamed of anything better than a silver
one. I shall be very proud of this one."
"And I am very glad to give it to you. In what direction do you
propose to journey!"
"Westward, sir. I haven't any very clear ideas further than that."
"Shall you go as far as Colorado?"
"Yes, sir; I think so."
"I have a nephew out there somewhere—Henry Thorp—a young
man of twenty-five. He is probably mining, but I don't know his
location. Should you run across him, ask him to communicate with
me. His aunt and myself will be glad to hear from him."
"I will not forget it, sir," said Dean, though he thought it quite
improbable that he and the nephew referred to would ever meet.
Dr. Thorp took his leave, and Dean soon after took leave of the
Gunnison family. He was pressed to remain and play another game
of baseball, but felt that he could not spare the time.
A week later found Dean only a hundred miles farther on his
way. He might have accomplished this distance on the cars in a few
hours, but he preferred to make a leisurely trip, looking out for a
chance to earn money on the way. But after a season of prosperity a
dull time had come to him. During the week he did not make a
single dollar. He encountered several fair-sized towns, but did not
feel able to give an entire entertainment himself. His stock of money
dwindled, and he began to feel anxious.
Towards nightfall he found himself apparently at a distance from
any town, and began to feel some solicitude as to where he could
pass the night. It was a mountain region, and the day seemed to be
shorter than on the plains. The air was chilly, and Dean felt that it
would be dangerous to spend the night out of doors.
In this emergency he was pleased to descry a rough cabin a
hundred feet from the road.
"There is shelter at any rate if they will take me In," thought
Dean. "I will take care not to wander into such a wild region again."
He went up to the door, and knocked with his bare knuckles.
He heard a shuffling noise inside, and an old woman, with gray
hair, unconfined and hanging loose like a horse's mane, faced him.
"Who are you?" she inquired abruptly.
"A traveler," answered Dean.
"What do you want?"
"I have lost my way. Can you let me stay here all night?"
"This isn't a tavern," she responded in a surly tone.
"I suppose not, but I am willing to pay for supper and a lodging.
I don't see any other house near by, or I would not trouble you."
The old woman eyed him with a curious scrutiny which made
him vaguely uncomfortable, so weird and uncanny was her look.
"Have you got any money?" she asked at last.
"A little," answered Dean, growing suddenly cautious.
"Well, you can come in," she said after a pause.
Dean entered, and cast a glance about him.
The cabin was certainly a primitive one. What furniture it
contained seemed home made, put together awkwardly with such
material as came to hand. In place of chairs were two boxes such as
are used to contain shoes, placed bottom up. There was a small
stove, the heat of which seemed grateful to the chilly young traveler.
"It is cold," remarked Dean, by way of opening the conversation.
"Humph!" answered the woman. "Have you come all the way to
tell me that?"
"Evidently the old woman isn't sociable," thought Dean.
"Where do you live when you're to home?" asked the woman
after a pause.
"In New York State."
"What did you come out here for?"
"I had my living to make," answered Dean, feeling
uncomfortable.
"I haven't found any, and I've lived here goin' on ten years. I
suppose you want some supper," she continued ungraciously.
"Yes, I am very hungry. I am sorry to put you to any trouble."
The woman did not answer, but going to a rude pantry took out
a plate of meat, and some dry bread. The former she put in the
oven, and proceeded to brew some tea.
Dean watched her preparations with eager interest. It seemed to
him that he had never been so hungry. He had probably walked ten
miles over a rough path, and the exercise had tired him as much as
twice the distance on the plain. Besides he had his valise with him,
and had found it decidedly an incumbrance.
From time to time the old woman paused in her preparations
and eyed him searchingly. What it was that attracted her attention
Dean could not guess till she suddenly pointed to his chain, and
asked, "Is there a watch at the end of that?"
"Yes," answered Dean with a sudden feeling of apprehension.
"Let me look at it."
Reluctantly he drew out the watch, and into the woman's eyes
crept a covetous gleam, as she advanced and took it in her hand.
"It's pretty," she said. "What's it worth?"
"I don't know," answered Dean. "I didn't buy it. It was a present
to me."
"It ought to be worth a good sum."
"I value it because it was given me by a friend," said Dean
hurriedly.
"We've got nothing to tell time by," said the woman, slowly, still
eying the watch with a fixed look, "except the sun."
Dean did not reply.
"How do you wind it up?" asked the woman after a pause. "Do
you have a key?"
"No; it's a stem-winder."
"What's that?"
"I will show you," and Dean wound the watch as far as it would
go.
"I never saw the like of that," said his hostess with a look of
mingled curiosity and surprise.
She released her hold upon the watch, and Dean put it back in
his pocket, rather relieved to have recovered possession of it again.
Five minutes later the meal was ready, such as it was.
"Set up," said the woman.
Dean obeyed with alacrity.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookmasss.com

You might also like