Skip to Content
Python in Excel Step-by-Step
book

Python in Excel Step-by-Step

by David Langer
January 2026
Beginner to intermediate
272 pages
6h 31m
English
Wiley
Content preview from Python in Excel Step-by-Step

Chapter 7Working with Columns

While dataframes are the fundamental unit of analysis when using Python in Excel, you typically spend more time working with individual columns rather than entire tables of data.

This chapter teaches you the fundamentals of working with pandas Series objects (i.e., columns), including the differences between numeric, string, and datetime columns.

These fundamentals are required for the next two chapters, which use a hypothetical data analysis example.

7.1 EXPLORING COLUMNS

This chapter’s Python code again uses the data from the PythonInExcelStepByStep.xlsx workbook. It’s highly recommended that you download the workbook and follow along by writing all the code.

As the amount of Python code in your workbook grows, you will see that it takes longer for all the code to run. Because Python in Excel calculates formulas in the left-most worksheet first, you can reorder the worksheets so that the Ch 7 Python Code worksheet is the farthest left if you like.

The first step is to load the dataframes you need from the tables stored in the workbook. The Python Editor provides the option of only looking at a specific worksheet’s Python formulas, as demonstrated in Figure 7.1.

Python Editor menu active with Sheets option under Worksheets selected, and Chapter 7 Python Code highlighted in an adjacent panel.

Figure 7-1: Selecting the Chapter 7 Worksheet.

As you’ve seen in previous chapters, I show you the code and output in textual form when screenshots of the Python Editor won’t add that ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Python for Excel

Python for Excel

Felix Zumstein

Publisher Resources

ISBN: 9781394340767Purchase Link