• Stars
    star
    570
  • Rank 78,245 (Top 2 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created over 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Materials for following along with Hands-On Data Analysis with Pandas – Second Edition

Hands-On Data Analysis with Pandas – Second Edition

Binder Open In Colab Nbviewer Purchase the book on Amazon Hands-On Data Analysis with Pandas

This is the code repository for my book Hands-On Data Analysis with Pandas, published by Packt on July 26, 2019 (1st edition) and April 29, 2021 (2nd edition).

Versions

This repository contains git tags for the materials as they were at time of publishing. Available tags:

Book Description

Data analysis has become an essential skill in a variety of domains where knowing how to work with data and extract insights can generate significant value. Hands-On Data Analysis with Pandas will show you how to analyze your data, get started with machine learning, and work effectively with the Python libraries often used for data science, such as pandas, NumPy, matplotlib, seaborn, and scikit-learn.

Using real-world datasets, you will learn how to use the pandas library to perform data wrangling to reshape, clean, and aggregate your data. Then, you will learn how to conduct exploratory data analysis by calculating summary statistics and visualizing the data to find patterns. In the concluding chapters, you will explore some applications of anomaly detection, regression, clustering, and classification using scikit-learn to make predictions based on past data.

This updated edition will equip you with the skills you need to use pandas 1.x to efficiently perform various data manipulation tasks, reliably reproduce analyses, and visualize your data for effective decision making—valuable knowledge that can be applied across multiple domains.

What You Will Learn

Prerequisite: If you don't have basic knowledge of Python or past experience with another language (R, SAS, MATLAB, etc.), consult the ch_01/python_101.ipynb Jupyter notebook for a Python crash-course/refresher.

  • Understand how data analysts and scientists gather and analyze data
  • Perform data analysis and data wrangling in Python
  • Combine, group, and aggregate data from multiple sources
  • Create data visualizations with pandas, matplotlib, and seaborn
  • Apply machine learning algorithms with sklearn to identify patterns and make predictions
  • Use Python data science libraries to analyze real-world datasets.
  • Use pandas to solve several common data representation and analysis problems
  • Collect data from APIs
  • Build Python scripts, modules, and packages for reusable analysis code.
  • Utilize computer science concepts and algorithms to write more efficient code for data analysis
  • Write and run simulations

Table of Contents

What's New in This Edition?

All the code examples have been updated for newer versions of the libraries used (see the requirements.txt file for the full list). The second edition also features new/revised examples highlighting new features. For pandas in particular, the first edition uses a much older version than what is currently available (pre 1.0), and this edition brings the content up to date with the latest version (1.x). You can look through the pandas release notes to get an idea of all the changes that have happened since the version of pandas used in the first edition (0.23.4). In addition, there are significant changes to the content of some chapters, while others have new and improved examples and/or datasets.

Notes on Environment Setup

Env Build Workflow Status GitHub repo size

Environment setup instructions are in the chapter 1 of the text. If you don't have the book, you will need to install Python >= 3.7 and < 3.10, set up a virtual environment, activate it, fork and clone this repository to obtain a local copy of the files, change the current directory to your local copy of the files, and then install the required packages using the requirements.txt file inside the directory (note that git will need to be installed). You can then launch JupyterLab and use the ch_01/checking_your_setup.ipynb Jupyter notebook to check your setup. Consult this resource if you have issues with using your virtual environment in Jupyter.

Alternatively, consider using this repository on Binder or Google Colab.

Windows Users

If you have Python 3.9+ installed, you should create a virtual environment with conda and specify Python 3.8 as discussed in this issue:

$ conda create --name book_env python=3.8

Alternatively, you can use the environment.yml file, which will create the environment and install all the required packages:

$ conda install mamba -n base -c conda-forge
$ cd Hands-On-Data-Analysis-with-Pandas-2nd-edition
~/Hands-On-Data-Analysis-with-Pandas-2nd-edition$ mamba env create --file environment.yml

Apple Silicon Users

Make sure to use Python 3.9 if you plan to install packages with pip. If you decide to use conda, make sure to first install mamba and use that to install everything using the m1_environment.yml file instead:

$ conda install mamba -n base -c conda-forge
$ cd Hands-On-Data-Analysis-with-Pandas-2nd-edition
~/Hands-On-Data-Analysis-with-Pandas-2nd-edition$ mamba env create --file m1_environment.yml

Solutions

Each chapter comes with exercises. The solutions for chapters 1-11 can be found here. Since the exercises in chapter 12 are open-ended, no solutions are provided.

About the Author

Stefanie Molin (@stefmolin) is a software engineer and data scientist at Bloomberg in New York City, where she tackles tough problems in information security, particularly those revolving around data wrangling/visualization, building tools for gathering data, and knowledge sharing. She holds a bachelor’s of science degree in operations research from Columbia University's Fu Foundation School of Engineering and Applied Science with minors in Economics and Entrepreneurship and Innovation, as well as a master’s degree in computer science, with a specialization in machine learning, from Georgia Tech. In her free time, she enjoys traveling the world, inventing new recipes, and learning new languages spoken both among people and computers.

Acknowledgements

Since the book limited the acknowledgements to 450 characters, the full version is here.

More Repositories

1

Hands-On-Data-Analysis-with-Pandas

Materials for following along with Hands-On Data Analysis with Pandas.
Jupyter Notebook
410
star
2

pandas-workshop

An introductory workshop on pandas with notebooks and exercises for following along. Slides contain all solutions.
Jupyter Notebook
340
star
3

stock-analysis

Simple to use interfaces for basic technical analysis of stocks.
Python
325
star
4

python-data-viz-workshop

A workshop on data visualization in Python with notebooks and exercises for following along. Slides contain all solutions.
Jupyter Notebook
239
star
5

data-morph

Morph an input dataset of 2D points into select shapes, while preserving the summary statistics to a given number of decimal points through simulated annealing. It is intended to be used as a teaching tool to illustrate the importance of data visualization.
Python
55
star
6

login-attempt-simulator

Simulation of regular login activity on a site and random activity from a hacker using a brute-force password guessing attack.
Python
14
star
7

ml-utils

Machine learning utility functions and classes.
Python
12
star
8

exif-stripper

Pre-commit hook to ensure image EXIF data is removed.
Python
8
star
9

pre-commit-workshop

"(Pre-)Commit to Better Code" workshop
6
star
10

airline-market-share-analysis

Blog post for OpenDataScience.com showing how to create a pivot table and stacked bar visualization of airline market share.
Jupyter Notebook
6
star
11

SCOPE-Anomaly-Detection-Case-Study

Case study on rules-based and machine learning models for anomaly detection used in SCOPE alerts.
Jupyter Notebook
5
star
12

Metis

Metis Web App built using Flask to collect opinions from users on KPI evolutions to use in Machine Learning Anomaly Detection methods.
Python
3
star
13

Custom-Colormaps

Utility functions for working with colors in Python.
Python
2
star
14

binder-environments

Central location for binder environments, especially those used with my book, Hands-On Data Analysis with Pandas.
2
star
15

R-training-program

This is the custom R training program I developed to teach fellow analysts using company data. All sensitive data has been removed.
R
1
star
16

Bulls-and-Cows

Bulls and Cows command line game for guessing a number.
Java
1
star
17

DidYouFeelIt

DidYouFeelIt? App from the Udacity Android Basics: Networking course (prerequisite for Grow with Google Android Developer Scholarship phase 1)
Java
1
star
18

stefmolin

Smarty
1
star
19

data-morph-talk

Slides for my talk "Data Morph: A Cautionary Tale of Summary Statistics"
HTML
1
star
20

Yeshiva-DAV5400

Template repository for Yeshiva's DAV5400 with configuration for GitHub codespaces (VS Code and JupyterLab).
1
star
21

stefmolin.github.io

My personal website (stefaniemolin.com).
TypeScript
1
star
22

SCOPE-anomaly-detection-emails

SCOPE Anomaly Detection System -- Sends daily emails with curated alerts to people who can investigate further.
HTML
1
star
23

CourtCounter

CourtCounter app from the Udacity Android Basics: User Input course (prerequisite for Grow with Google Android Developer Scholarship phase 1)
Java
1
star