Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Python Data Analysis Cookbook

You're reading from   Python Data Analysis Cookbook Clean, scrape, analyze, and visualize data with the power of Python!

Arrow left icon
Product type Paperback
Published in Jul 2016
Publisher
ISBN-13 9781785282287
Length 462 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ivan Idris Ivan Idris
Author Profile Icon Ivan Idris
Ivan Idris
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Laying the Foundation for Reproducible Data Analysis FREE CHAPTER 2. Creating Attractive Data Visualizations 3. Statistical Data Analysis and Probability 4. Dealing with Data and Numerical Issues 5. Web Mining, Databases, and Big Data 6. Signal Processing and Timeseries 7. Selecting Stocks with Financial Data Analysis 8. Text Mining and Social Network Analysis 9. Ensemble Learning and Dimensionality Reduction 10. Evaluating Classifiers, Regressors, and Clusters 11. Analyzing Images 12. Parallelism and Performance A. Glossary
B. Function Reference C. Online Resources D. Tips and Tricks for Command-Line and Miscellaneous Tools Index

Graphing Anscombe's quartet


Anscombe's quartet is a classic example that illustrates why visualizing data is important. The quartet consists of four datasets with similar statistical properties. Each dataset has a series of x values and dependent y values. We will tabulate these metrics in an IPython notebook. However, if you plot the datasets, they look surprisingly different compared to each other.

How to do it...

For this recipe, you need to perform the following steps:

  1. Start with the following imports:

    import pandas as pd
    import seaborn as sns
    import matplotlib.pyplot as plt
    import matplotlib as mpl
    from dautil import report
    from dautil import plotting
    import numpy as np
    from tabulate import tabulate
  2. Define the following function to compute the mean, variance, and correlation of x and y within a dataset, the slope, and the intercept of a linear fit for each of the datasets:

    df = sns.load_dataset("anscombe")
    
        agg = df.groupby('dataset')\
                 .agg([np.mean, np.var])\
             ...
lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Python Data Analysis Cookbook
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime
Modal Close icon
Modal Close icon