Mastering Python Data Visualization
eBook - ePub

Mastering Python Data Visualization

  1. 372 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering Python Data Visualization

About this book

Generate effective results in a variety of visually appealing charts using the plotting packages in Python

About This Book

  • Explore various tools and their strengths while building meaningful representations that can make it easier to understand data
  • Packed with computational methods and algorithms in diverse fields of science
  • Written in an easy-to-follow categorical style, this book discusses some niche techniques that will make your code easier to work with and reuse

Who This Book Is For

If you are a Python developer who performs data visualization and wants to develop existing knowledge about Python to build analytical results and produce some amazing visual display, then this book is for you. A basic knowledge level and understanding of Python libraries is assumed.

What You Will Learn

  • Gather, cleanse, access, and map data to a visual framework
  • Recognize which visualization method is applicable and learn best practices for data visualization
  • Get acquainted with reader-driven narratives and author-driven narratives and the principles of perception
  • Understand why Python is an effective tool to be used for numerical computation much like MATLAB, and explore some interesting data structures that come with it
  • Explore with various visualization choices how Python can be very useful in computation in the field of finance and statistics
  • Get to know why Python is the second choice after Java, and is used frequently in the field of machine learning
  • Compare Python with other visualization approaches using Julia and a JavaScript-based framework such as D3.js
  • Discover how Python can be used in conjunction with NoSQL such as Hive to produce results efficiently in a distributed environment

In Detail

Python has a handful of open source libraries for numerical computations involving optimization, linear algebra, integration, interpolation, and other special functions using array objects, machine learning, data mining, and plotting. Pandas have a productive environment for data analysis. These libraries have a specific purpose and play an important role in the research into diverse domains including economics, finance, biological sciences, social science, health care, and many more. The variety of tools and approaches available within Python community is stunning, and can bolster and enhance visual story experiences.

This book offers practical guidance to help you on the journey to effective data visualization. Commencing with a chapter on the data framework, which explains the transformation of data into information and eventually knowledge, this book subsequently covers the complete visualization process using the most popular Python libraries with working examples. You will learn the usage of Numpy, Scipy, IPython, MatPlotLib, Pandas, Patsy, and Scikit-Learn with a focus on generating results that can be visualized in many different ways. Further chapters are aimed at not only showing advanced techniques such as interactive plotting; numerical, graphical linear, and non-linear regression; clustering and classification, but also in helping you understand the aesthetics and best practices of data visualization. The book concludes with interesting examples such as social networks, directed graph examples in real-life, data structures appropriate for these problems, and network analysis.

By the end of this book, you will be able to effectively solve a broad set of data analysis problems.

Style and approach

The approach of this book is not step by step, but rather categorical. The categories are based on fields such as bioinformatics, statistical and machine learning, financial computation, and linear algebra. This approach is beneficial for the community in many different fields of work and also helps you learn how one approach can make sense across many fields

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Mastering Python Data Visualization


Table of Contents

Mastering Python Data Visualization
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. A Conceptual Framework for Data Visualization
Data, information, knowledge, and insight
Data
Information
Knowledge
Data analysis and insight
The transformation of data
Transforming data into information
Data collection
Data preprocessing
Data processing
Organizing data
Getting datasets
Transforming information into knowledge
Transforming knowledge into insight
Data visualization history
Visualization before computers
Minard's Russian campaign (1812)
The Cholera epidemics in London (1831-1855)
Statistical graphics (1850-1915)
Later developments in data visualization
How does visualization help decision-making?
Where does visualization fit in?
Data visualization today
What is a good visualization?
Visualization plots
Bar graphs and pie charts
Bar graphs
Pie charts
Box plots
Scatter plots and bubble charts
Scatter plots
Bubble charts
KDE plots
Summary
2. Data Analysis and Visualization
Why does visualization require planning?
The Ebola example
A sports example
Visually representing the results
Creating interesting stories with data
Why are stories so important?
Reader-driven narratives
Gapminder
The State of the Union address
Mortality rate in the USA
A few other example narratives
Author-driven narratives
Perception and presentation methods
The Gestalt principles of perception
Some best practices for visualization
Comparison and ranking
Correlation
Distribution
Location-specific or geodata
Part-to-whole relationships
Trends over time
Visualization tools in Python
Development tools
Canopy from Enthought
Anaconda from Continuum Analytics
Interactive visualization
Event listeners
Layouts
Circular layout
Radial layout
Balloon layout
Summary
3. Getting Started with the Python IDE
The IDE tools in Python
Python 3.x versus Python 2.7
Types of interactive tools
IPython
Plotly
Types of Python IDE
PyCharm
PyDev
Interactive Editor for Python (IEP)
Canopy from Enthought
Anaconda from Continuum Analytics
An overview of Spyder
An overview of conda
Visualization plots with Anaconda
The surface-3D plot
The square map plot
Interactive visualization packages
Bokeh
VisPy
Summary
4. Numerical Computing and Interactive Plotting
NumPy, SciPy, and MKL functions
NumPy
NumPy universal functions
Shape and reshape manipulation
An example of interpolation
Vectorizing functions
Summary of NumPy linear algebra
SciPy
An example of linear equations
The vectorized numerical derivative
MKL functions
The performance of Python
Scalar selection
Slicing
Slice using flat
Array indexing
Numerical indexing
Logical indexing
Other data structures
Stacks
Tuples
Sets
Queues
Dictionaries
Dictionaries for matrix representation
Sparse matrices
Visualizing sparseness
Dictionaries for memoization
Tries
Visualization using matplotlib
Word clouds
Installing word clouds
Input for word clouds
Web feeds
The Twitter text
Plotting the stock price chart
Obtaining data
The visualization example in sports
Summary
5. Financial and Statistical Models
The deterministic model
Gross returns
The stochastic model
Monte Carlo simulation
What exactly is Monte Carlo simulation?
An inventory problem in Monte Carlo simulation
Monte Carlo simulation in basketball
The volatility plot
Implied volatilities
The portfolio valuation
The simulation model
Geometric Brownian simulation
The diffusion-based simulation
The threshold model
Schelling's Segregation Model
An overview of statistical and machine learning
K-nearest neighbors
Generalized linear models
Bayesian linear regression
Creating animated and interactive plots
Summary
6. Statistical and Machine Learning
Classification methods
Understanding linear regression
Linear regression
Decision tree
An example
The Bayes theorem
The Naïve Bayes classifier
The Naïve Bayes classifier using TextBlob
Installing TextBlob
Downloading corpora
The Naïve Bayes classifier using TextBlob
Viewing positive sentiments using word clouds
k-nearest neighbors
Logistic regression
Support vector machines
Principal component analysis
Installing scikit-learn
k-means clustering
Summary
7. Bioinformatics, Genetics, and Network Models
Directed graphs and multigraphs
Storing graph data
Displaying graphs
igraph
NetworkX
Graph-tool
PageRank
The clustering coefficient of graphs
Analysis of social networks
The planar graph test
The directed acyclic graph test
Maximum flow and minimum cut
A genetic programming example
Stochastic block models
Summary
8. Advanced Visualization
Computer simulation
Python's random package
SciPy's random functions
Simulation examples
Signal processing
Animation
Visualization methods using HTML5
How is Julia different from Python?
D3.js for visualization
Dashboards
Summary
A. Go Forth and Explore Visualization
An overview of conda
Packages installed with Anaconda
Packages websites
About matplotlib
Index

Mastering Python Data Visualization

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2015
Production reference: 1211015
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-832-7
www.packtpub.com

Credits

Author
Kirthi Raman
Reviewers
Julian Quick
Hang (Harvey) Yu
Acquisition Editor
Subho Gupta
...

Table of contents

  1. Mastering Python Data Visualization

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Mastering Python Data Visualization by Kirthi Raman in PDF and/or ePUB format, as well as other popular books in Computer Science & Data Processing. We have over one million books available in our catalogue for you to explore.