Get complete instructions for manipulating, processing, cleaning, and crunching datasets in Python. Updated for Python 3.6, the second edition of this hands-on guide is packed with practical case studies that show you how to solve a broad set of data analysis problems effectively. You’ll learn the latest versions of pandas, NumPy, IPython, and Jupyter in the process.
Written by Wes McKinney, the creator of the Python pandas project, this book is a practical, modern introduction to data science tools in Python. It’s ideal for analysts new to Python and for Python programmers new to data science and scientific computing. Data files and related material are available on GitHub.
Use the IPython shell and Jupyter notebook for exploratory computing
Learn basic and advanced features in NumPy (Numerical Python)
Get started with data analysis tools in the pandas library
Use flexible tools to load, clean, transform, merge, and reshape data
Create informative visualizations with matplotlib
Apply the pandas groupby facility to slice, dice, and summarize datasets
Analyze and manipulate regular and irregular time series data
Learn how to solve real-world data analysis problems with thorough, detailed examples
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A hands-on, practical introduction to data analysis in Python, this book teaches you how to load, clean, transform, and visualize data using pandas, NumPy, and IPython/Jupyter—ideal for analysts new to Python or programmers new to scientific computing.
【Book Arc】
- **Opening (~0%–9%)**: Sets up the environment and core concepts. Covers installing Python via Anaconda, managing packages with conda/pip, and introduces the IPython shell and Jupyter notebook as the primary exploratory computing tools.
- **Early (~9%–25%)**: Builds Python language fundamentals. Reviews scalar types, mutable vs. immutable objects, control flow (if/for loops with break/continue), data structures like lists, dicts, and sets, plus generators and the iterator protocol—essential groundwork for data work.
- **Early (~25%–34%)**: Dives into NumPy basics. Explains array creation, indexing (including boolean and fancy indexing), vectorized operations, and the np.where function for conditional logic—the foundation for fast numerical computation.
- **Middle (~34%–44%)**: Advances NumPy skills. Covers mathematical and statistical methods (sum, mean, std) with axis arguments, array-oriented programming, and a practical example of simulating random walks using cumulative sums.
- **Middle (~44%–47%)**: Introduces pandas data structures. Focuses on Series and DataFrame, including the drop method for deleting rows/columns, handling arithmetic with differently indexed objects (fill_value), and the complications of duplicate axis labels.
【Key Takeaways】
- **Environment setup is the first hurdle** (Opening): Use Anaconda for a reproducible Python data stack; prefer conda over pip for updating packages to avoid environment conflicts. This saves hours of dependency headaches.
- **IPython/Jupyter are the exploratory workhorses** (Opening): Nearly all commands work in both the shell and notebook; magic functions and matplotlib integration make iterative analysis fluid. Master Shift-Enter in notebooks for quick experimentation.
- **Immutability reduces bugs** (Early): Python objects are mostly mutable, but side effects in functions should be avoided; favor immutable types like tuples where possible for safer code.
- **Generators enable lazy, memory-efficient iteration** (Early): Using yield instead of return creates sequences that produce values on demand—critical for handling large datasets without loading everything at once.
- **NumPy vectorization replaces slow loops** (Early–Middle): Boolean and fancy indexing let you select and modify array subsets in one line; np.where offers clean conditional logic. This is the key to fast numerical work.
- **Axis-aware aggregations are powerful** (Middle): Methods like sum and mean accept an axis argument to compute statistics over rows or columns, reducing multidimensional data efficiently.
- **pandas alignment handles mismatched data gracefully** (Middle): Arithmetic between differently indexed objects produces NaN for non-overlapping labels; use add with fill_value to control missing data behavior.
- **Duplicate labels complicate indexing** (Middle): When axis labels repeat, indexing returns a Series instead of a scalar, making output types unpredictable—check is_unique and design data accordingly.
【Reading Tips】
- **Skim the Python basics chapter** (~9%–25%) if you're already comfortable with Python; focus instead on the NumPy and pandas sections where the real value lies.
- **Deep-read the NumPy chapters** (~25%–44%): Work through the array indexing and np.where examples line-by-line in Jupyter—these patterns recur throughout the book.
- **Pay special attention to the pandas alignment section** (~44%–47%): Understanding how NaN propagates in arithmetic is crucial for real-world data cleaning; test the fill_value examples yourself.
- **Practice with the random walk example** (~38%–44%): It ties together NumPy's random module, vectorization, and cumulative sums—a mini-project that solidifies core skills.
- **Keep the book's GitHub repo handy**: The companion notebooks let you follow along without typing every example, but type the key ones manually to build muscle memory.
【Coverage Limits】
The excerpts cover roughly the first half of the book (through pandas fundamentals). Later chapters on data cleaning, merging, visualization with matplotlib, groupby, and time series are not covered in this guide.
Page 10
(Leading and Lagging) Data 332 11.4 Time Zone Handling 335 Time Zone Localization and Conversion 335 Operations with Time Zone−Aware Timestamp Objects 338 Op...
, boolean (True or False) values, and dates and time. These “single value” types are sometimes called scalar types and we refer to them in this book as scala...
0xb1 in position 0: invalid s tart byte In [244]: f.close() If you find yourself regularly doing data analysis on non-ASCII text data, mastering Python’s Uni...
ed by pandas.cut. You can treat it like an array of strings indicating the bin name; internally it contains a categories array specifying the dis‐ tinct cate...
the percent of the figure width and figure height, respec‐ tively, to use as spacing between subplots. Here is a small example where I shrink the spacing all...
these basic usage mechanics, getting the most out of apply may require some creativity. What occurs inside the function passed is up to you; it only needs to...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Python for Data Analysis Data Wrangling with Pandas, NumPy, and IPython (Wes McKinney) (Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Python for Data Analysis Data Wrangling with Pandas, NumPy, and IPython (Wes McKinney) (Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment