Excel + Python: Speed Up Data Analysis and Processing cover

Excel + Python: Speed Up Data Analysis and Processing

Rating 3.5
Word count
217K words
Chapters
40
Series
Many Python books teach you to write code but never show how to apply it to the reports you submit every day; many Excel books teach tricks that buckle once the data reaches tens of thousands of rows. What sets this book apart is its author, Felix Zumstein, the founder of the open-source library xlwings—he has spent years solving automation problems for Excel users, so nearly every chapter starts from "the trouble you run into in a spreadsheet" rather than from syntax. The structure is equally practical: first lay out the Python basics and development environment so complete beginners don't stall at step one; then use pandas to cover the genuinely high-frequency needs of data cleaning, grouped statistics, time-series processing, and report generation; and finally devote four full chapters to xlwings, treating Excel as the front end of a Python program and showing how to build small tools you can hand to colleagues, even covering deployment and user-defined functions. The book also discusses alternatives to VBA, Power Query, and Power Pivot, so that after reading it you can judge which tasks should stay in Excel and which should move to Python. The original was published by O'Reilly, and the Chinese edition is brought in by Turing; the translation is accurate and the terminology standard, and the companion code can be typed along with. This is not a quick-reference manual but a hands-on tutorial worth working through from beginning to end—run the examples in all twelve chapters and you will genuinely have a new set of automated workflows at your fingertips.
ISBN
9787115586766

Tags

Summary

In today's office environment, large datasets are everywhere—files with hundreds of thousands or even millions of rows are not rare—and Excel's bottlenecks in data volume, formula maintenance, and repetitive operations are becoming ever more obvious. This book is aimed at users who know Excel but have no programming background, and introduces how to "bolt on" Python for Excel: keep Excel's strengths as an interactive interface and reporting tool, while drawing on Python's abilities in data processing, scientific computing, and automation to hand tedious, error-prone work over to scripts. The book has four parts. Part 1 is an introduction to Python: it first explains why one would program Excel with Python, compares Python's advantages over VBA in readability, maintainability, the standard library, and the scientific computing ecosystem, then guides readers through setting up Anaconda, Jupyter Notebook, and VS Code, and quickly runs through data types, data structures, control flow, and the basic syntax of organizing code. Part 2 moves into pandas: starting from NumPy array fundamentals, it introduces DataFrame and Series, data cleaning and combining, descriptive statistics and plotting, data import and export, and time-series analysis based on DatetimeIndex. Part 3 covers reading and writing Excel files outside Excel: using pandas to batch-read and generate reports, and using dedicated read/write packages when fine-grained control over formatting is needed. Part 4 is the heart of the book—programming the Excel application with xlwings: automating workbooks, building Python tools with Excel as the front end, a complete walk-through of developing and deploying the "Python Package Tracker" application, and an introduction to user-defined functions (UDFs) that call Python functions from within Excel. The appendices add Conda environments, advanced VS Code features, and further Python concepts. The whole book is case-driven, with code that runs directly in Jupyter Notebook, and is suitable for office workers who want to automate repetitive work and upgrade their Excel skills into data analysis ability.

Editor's review

很多Python书教你写代码,却不告诉你这些代码怎么用在每天要交的报表上;很多Excel书教技巧,却在数据量上万行时开始力不从心。这本书的特别之处在于,作者费利克斯·朱姆斯坦正是开源库xlwings的创始人——他长期为Excel用户解决自动化问题,因此全书几乎每一章都从「你在表格里遇到的麻烦」出发,而不是从语法讲起。 结构安排也很务实:先花篇幅把Python基础和开发环境铺好,让零基础读者不至于卡在第一步;再用pandas覆盖数据清洗、分组统计、时序处理和报表生成这些真正高频的需求;最后用整整四章讲xlwings,把Excel当作Python程序的前端,演示如何做成能交给同事使用的小工具,甚至讲到部署和用户定义函数。书中还讲了VBA与Power Query、Power Pivot的替代思路,读完能判断哪些活儿该继续留在Excel,哪些该搬到Python。 原书由O'Reilly出版,中文版由图灵引进,译文准确、术语规范,配套代码可以跟着敲。它不是速查手册,而是一本值得从头做到尾的实战教程——把十二个章节的示例跑一遍,你手里就真的多了一套自动化流程。

Who it's for

A good fit for

  • 日常要用Excel处理报表、台账、对账,希望摆脱重复劳动的在职人士
  • 零编程基础但愿意动手练习,想把Excel技能升级为数据处理能力的人
  • 需要频繁合并多个表格、清洗数万行数据的学生与科研人员
  • 已会一点Python,想了解pandas和xlwings如何在办公场景落地的人

Not a good fit for

  • 完全不愿写代码、只想学几个Excel快捷键的读者
  • 想深入钻研机器学习算法或统计建模理论的读者
  • 需要查阅VBA宏、Power Query详细语法的资深Excel用户

Reading tips

  1. 务必按照第2章搭好Anaconda、Jupyter和VS Code环境,环境对了后面才顺
  2. 前六章不要跳读,pandas的索引与数据类型是后面所有案例的地基
  3. 第7至12章建议一边读一边在自己的真实报表上复现,比抄示例更有效
  4. 可以把每章小结当作复习清单,读完一章用自己的数据做一个小练习

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Copyright Notice
  2. About O'Reilly Media
  3. Praise for This Book
  4. Preface
  5. Part 1. Python Introduction
  6. Chapter 1. Why Program Excel with Python
  7. 1.1 Excel as a Programming Language
  8. 1.2 Python for Excel
  9. 1.3 Summary
  10. Chapter 2. Development Environment
  11. 2.1 The Anaconda Python Distribution
  12. 2.2 Jupyter Notebook
  13. 2.3 VS Code
  14. 2.4 Summary
  15. Chapter 3. Introduction to Python
  16. 3.1 Data Types
  17. 3.2 Indexing and Slicing
  18. 3.3 Data Structures
  19. 3.4 Control Flow
  20. 3.5 Organizing Code
  21. 3.6 PEP 8: The Python Style Guide
  22. 3.7 Summary
  23. Part 2. Introduction to pandas
  24. Chapter 4. NumPy Fundamentals
  25. 4.1 Getting Started with NumPy
  26. 4.2 Creating and Manipulating Arrays
  27. 4.3 Summary
  28. Chapter 5. Data Analysis with pandas
  29. 5.1 DataFrame and Series
  30. 5.2 Data Manipulation
  31. 5.3 Combining DataFrames
  32. 5.4 Descriptive Statistics and Data Aggregation
  33. 5.5 Plotting
  34. 5.6 Importing and Exporting DataFrames
  35. 5.7 Summary
  36. Chapter 6. Time Series Analysis with pandas
  37. 6.1 DatetimeIndex
  38. 6.2 Common Time Series Operations
  39. 6.3 Limitations of pandas
  40. 6.4 Summary

FAQ

完全没有编程基础,能读懂这本书吗?
可以。本书正是为没有编程经验的Excel用户写的,第一部分从数据类型、循环、函数讲起,并附有开发环境安装步骤。但需要你愿意动手敲代码、跑示例;只看不练会很难跟上第四部分的xlwings内容。
学这本书需要安装哪些软件?
书中建议安装Anaconda个人版,它自带Python解释器、Jupyter笔记本以及pandas、OpenPyXL、xlwings等常用包;编辑器使用免费的VS Code并安装Python扩展。附录A和附录B分别补充了Conda环境和VS Code的高级用法。
xlwings和pandas分别解决什么问题?
pandas负责在Excel之外批量处理数据,适合读取多个文件、清洗数据、分组统计和生成报表;xlwings负责在Excel之内控制工作簿,适合自动化打开、刷新、填写表格,以及把Excel当作Python工具的前端界面。
这本书能替代VBA吗?
书中比较了Python相对VBA在可读性、可维护性、标准库和跨平台方面的优势,并演示用xlwings替代宏和用户定义函数。是否完全替代取决于团队环境:如果同事都用Windows版Excel且需要宏随文件分发,VBA仍有便利之处。
中文版与原书有差别吗?
中文版依据O'Reilly原书Python for Excel翻译,由冯黎翻译、图灵引进,正文结构与原书一致,包含四大部分共12章及三个附录。中文版将代码注释和术语做了本地化,示例代码逻辑不变。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

Top rated in the same category