Python for Data Analysis (3rd Edition) cover

Python for Data Analysis (3rd Edition)

No rating yet
Word count
635K words
Chapters
16
ISBN
9787111726722

Tags

Summary

Written by Wes McKinney, the creator of the pandas data analysis library, and translated into Chinese by Chen Song, Python for Data Analysis (3rd Edition) was published in Chinese by China Machine Press in 2023. Since the first edition appeared in 2012, the book has been a widely used reference in the field of Python data analysis; the third edition has been systematically updated for Python 3.10 and pandas 1.4, removing outdated tools that are no longer compatible and adding new features and methods. The book is organized around the actual workflow of data analysis and can be roughly divided into four parts. It first introduces the basics of the Python language, how to use IPython/Jupyter, and data structures, functions, and file operations. It then explains NumPy's foundational capabilities—the ndarray, vectorized computation, universal functions, file reading and writing, and linear algebra—along with pandas' two core data structures and basic operations. Next, it systematically walks through the common stages of data processing: reading and writing text and binary data, interacting with Web APIs and databases, missing values and data transformation, strings and categorical data, hierarchical indexing, joining, merging, and reshaping, GroupBy aggregation and grouping, pivot tables and cross-tabulation, time series and resampling, moving window functions, and visualization with matplotlib, pandas, and seaborn. Finally, it describes how modeling tools such as Patsy, statsmodels, and scikit-learn connect with pandas, and demonstrates a complete data analysis workflow through case studies including Bitly user behavior, MovieLens movie ratings, U.S. baby names, the USDA food database, and the Federal Election Commission database. At roughly 635,000 Chinese characters, the book includes two appendices on advanced NumPy and IPython and emphasizes tool usage and hands-on practice rather than statistical theory, making it suitable as a desk reference to consult as needed.

Editor's review

这本书最大的说服力来自作者身份:韦斯·麦金尼是 pandas 的创造者,他写 pandas 和 NumPy 的用法,等于由工具的造物主亲自讲解设计意图与使用范式。因此书中不少看似细枝末节的建议(例如某个索引操作为什么快、某种写法为什么要避免),都带有来自源码与工程实践的判断,这是同类教程较难替代的部分。 第3版并非简单重印:全书的案例与代码按 Python 3.10 和 pandas 1.4 通盘更新,删掉了已不兼容的旧工具,补上了扩展数据类型、分类数据等较新的内容,读者不必再为版本差异反复试错。结构上从语法、IPython/Jupyter 起步,经 NumPy 与 pandas 两大核心库,再到清洗、规整、分组聚合、时间序列与可视化,最后落到建模库对接和五个真实数据集案例,基本覆盖了数据分析师日常的完整工序。 需要提醒的是,这是一本工具书,并非统计教材:它教你如何把数据读进来、理干净、算出来、画出来,但不会替你补回归、假设检验的理论课;另外全书篇幅大、代码密度高,仅靠从头通读容易疲劳,更适合边开 Jupyter 边对照敲。翻译与代码排版在读者中有不同意见,遇到读不通的段落,直接对照官方示例数据动手验证往往比反复琢磨译文更有效。

Who it's for

A good fit for

  • 已掌握 Python 基本语法,想系统学习 NumPy 与 pandas 的读者
  • 数据分析师、BI 与报表岗位,需要处理表格、清洗与聚合数据的从业者
  • 统计、经济、金融等专业学生,需要把课程作业落到代码上的读者
  • 想从 Excel 转向 Python 处理百万行级数据的职场人
  • 做时间序列、日志或行为数据分析,需要完整流程参考的技术人员

Not a good fit for

  • 完全零编程基础的读者,书中语法部分只是快速带过
  • 希望系统学习统计学理论与建模原理的人
  • 只想学 SQL 或 Excel 做分析、不打算写 Python 的读者

Reading tips

  1. 先配好 Python 3.10 及以上的环境与 Jupyter,从官方 GitHub 下载示例数据,边读边敲,不要只做阅读。
  2. 第一遍可只读第2—5章与第7—8章,掌握 NumPy、pandas 的核心操作,其余章节按需查阅。
  3. 把第13章五个案例当作综合练习,读完自己用不同数据集重做一遍,检验流程是否真正打通。
  4. 注意 pandas 版本更迭较快,遇到弃用警告时以官方文档为准,不必强行沿用书中的旧写法。

About the publisher

China Machine Press China · Founded in 1950

In addition to science and technology and professional publishing, the books in our catalog from China Machine Press also reflect a sustained focus on psychology, computing, management, finance and economics, and social sciences. In psychology, the catalog includes works by C. G. Jung and introductions to analytical psychology, as well as applied topics such as stress and health, and addiction and healing. In computing, it features Structure and Interpretation of Computer Programs (JavaScript Edition). Management and finance titles include Administrative Behavior (4th Edition), The Price of Inequality (Collector's Edition), and This Time Is Different: Eight Centuries of Financial Folly (Commemorative Edition). In the philosophy and history of science, there is The Worldview: The Third Edition. Relevant authors include C. G. Jung, William McGuire, Sonu Shamdasani, and Gabor Maté. Public information is limited; the above summarizes the publisher's profile based solely on the books in our catalog.

Contents

  1. Preface
  2. Chapter 1. Preliminaries (What Is This Book About?, Why Python for Data Analysis?, Essential Python Libraries, Installation and Setup, Community and Conferences, Navigating This Book)
  3. Chapter 2. Python Language Basics, IPython, and Jupyter Notebooks (The Python Interpreter, IPython Basics, Python Language Basics, Conclusion)
  4. Chapter 3. Built-In Data Structures, Functions, and Files (Data Structures and Sequences, Functions, Files and the Operating System, Conclusion)
  5. Chapter 4. NumPy Basics: Arrays and Vectorized Computation (The NumPy ndarray: A Multidimensional Array Object, Generating Pseudorandom Numbers, Universal Functions: Fast Element-Wise Array Functions, Array-Oriented Programming with Arrays, File Input and Output with Arrays, Linear Algebra, Example: Random Walks, Conclusion)
  6. Chapter 5. Getting Started with pandas (Introduction to pandas Data Structures, Essential Functionality, Summarizing and Computing Descriptive Statistics, Conclusion)
  7. Chapter 6. Data Loading, Storage, and File Formats (Reading and Writing Data in Text Format, Binary Data Formats, Interacting with Web APIs, Interacting with Databases, Conclusion)
  8. Chapter 7. Data Cleaning and Preparation (Handling Missing Data, Data Transformation, Extension Data Types, String Manipulation, Categorical Data, Conclusion)
  9. Chapter 8. Data Wrangling: Join, Combine, and Reshape (Hierarchical Indexing, Combining and Merging Datasets, Reshaping and Pivoting, Conclusion)
  10. Chapter 9. Plotting and Visualization (A Brief matplotlib API Primer, Plotting with pandas and seaborn, Other Python Visualization Tools, Conclusion)
  11. Chapter 10. Data Aggregation and Group Operations (GroupBy Mechanics, Data Aggregation, Apply: Split-Apply-Combine, Group Transforms and "Unwrapped" GroupBy Operations, Pivot Tables and Cross-Tabulation, Conclusion)
  12. Chapter 11. Time Series (Date and Time Data Types and Tools, Basics of Time Series, Date Ranges, Frequencies, and Shifting, Time Zone Handling, Periods and Period Arithmetic, Resampling and Frequency Conversion, Moving Window Functions, Conclusion)
  13. Chapter 12. Introduction to Modeling Libraries in Python (Interfacing Between pandas and Model Code, Creating Model Descriptions with Patsy, Introduction to statsmodels, Introduction to scikit-learn, Conclusion)
  14. Chapter 13. Data Analysis Examples (Bitly Data from 1.USA.gov, MovieLens 1M Dataset, US Baby Names 1880–2010, USDA Food Database, 2012 Federal Election Commission Database, Conclusion)
  15. Appendix A. Advanced NumPy
  16. Appendix B. More on the IPython System

FAQ

这本书适合零基础学 Python 的人吗?
不太适合。书中第2—3章只是快速复习 Python 语法、数据结构与文件操作,篇幅有限,默认读者已经能写基本脚本。完全没有编程基础的话,建议先过一遍 Python 入门教程,再回来看这本书效率更高。
第3版和之前的版本有什么区别?
第3版针对 Python 3.10 与 pandas 1.4 做了全面更新,移除不再兼容的旧工具与写法,补充了扩展数据类型、分类数据等新内容,并重写了案例代码。如果你在用的 pandas 是 1.x 之后的版本,优先选第3版,可以少踩很多版本坑。
书中的代码和示例数据在哪里获取?
作者把数据文件与配套材料放到了 GitHub 仓库,读者可以按书中的说明下载对应版本的数据集。建议固定使用与书中一致的 pandas 版本运行示例,避免因 API 变化导致代码报错。
这本书能学到统计建模和机器学习吗?
只能学到入门级别的衔接。第12章介绍如何把 pandas 的数据交给 Patsy、statsmodels 与 scikit-learn,但只讲接口与基本用法,不推导原理。要做建模,需要另配统计教材和 scikit-learn 相关书籍。
必须按顺序从头读到尾吗?
不必。第1—5章是后面所有内容的地基,建议按顺序读;第6—11章可按手头任务挑着看,例如处理时间数据就直接翻第11章;第13章的案例可以留到最后作为综合练习。

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.

About the author

Wes McKinney is a technical author known for his work on data analysis and scientific computing, and his Chinese name is often associated with the topic of Python data analysis among readers of computer books. Publicly available information is limited: his nationality, birth and death dates, and educational background are not conclusively recorded, and the library currently holds one of his works. His representative work is Python for Data Analysis (2nd Edition), which focuses on the practical use of Python in data processing, cleaning, wrangling, and analysis. The book emphasizes tool operation and case demonstrations and is a practical technical work in the general computer category. McKinney's writing style combines programming methods with real data scenarios; the language is direct and the steps are clear, making it suitable for readers who want to use Python for data analysis. The book has circulated widely among Chinese readers, is often regarded as one of the introductory works for entering the field of Python data analysis, and reflects the author's practical experience and approach to data handling.

More by the same author

Top rated in the same category