100% found this document useful (1 vote)
14 views

Python Business Intelligence Cookbook 1st Edition Robert Dempsey download

The 'Python Business Intelligence Cookbook' by Robert Dempsey provides practical recipes for using Python in business intelligence tasks, including data preparation, exploration, analysis, visualization, and reporting. The book covers essential libraries, installation guides, and step-by-step instructions for various data manipulation techniques. It aims to empower readers to transform raw data into actionable insights for informed business decision-making.

Uploaded by

qunalosh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
14 views

Python Business Intelligence Cookbook 1st Edition Robert Dempsey download

The 'Python Business Intelligence Cookbook' by Robert Dempsey provides practical recipes for using Python in business intelligence tasks, including data preparation, exploration, analysis, visualization, and reporting. The book covers essential libraries, installation guides, and step-by-step instructions for various data manipulation techniques. It aims to empower readers to transform raw data into actionable insights for informed business decision-making.

Uploaded by

qunalosh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Python Business Intelligence Cookbook 1st

Edition Robert Dempsey pdf download

https://ebookfinal.com/download/python-business-intelligence-
cookbook-1st-edition-robert-dempsey/

Explore and download more ebooks or textbooks


at ebookfinal.com
We have selected some products that you may be interested in
Click the link to download now or visit ebookfinal.com
for more options!.

Artificial intelligence with python 1st Edition Prateek


Joshi

https://ebookfinal.com/download/artificial-intelligence-with-
python-1st-edition-prateek-joshi/

Python and AWS cookbook 1st Edition Mitch Garnaat

https://ebookfinal.com/download/python-and-aws-cookbook-1st-edition-
mitch-garnaat/

Python Parallel Programming Cookbook 1st Edition Giancarlo


Zaccone

https://ebookfinal.com/download/python-parallel-programming-
cookbook-1st-edition-giancarlo-zaccone/

Python Cookbook 2nd ed Edition Alex Martelli

https://ebookfinal.com/download/python-cookbook-2nd-ed-edition-alex-
martelli/
NumPy Cookbook Python 2nd Edition Ivan Idris

https://ebookfinal.com/download/numpy-cookbook-python-2nd-edition-
ivan-idris/

Applied Intelligence 1st Edition Robert J. Sternberg

https://ebookfinal.com/download/applied-intelligence-1st-edition-
robert-j-sternberg/

Raspberry Pi 3 Cookbook for Python Programmers Third


Edition Tim Cox

https://ebookfinal.com/download/raspberry-pi-3-cookbook-for-python-
programmers-third-edition-tim-cox/

Raspberry Pi for Python Programmers Cookbook 2nd, revised


Edition Tim Cox

https://ebookfinal.com/download/raspberry-pi-for-python-programmers-
cookbook-2nd-revised-edition-tim-cox/

Business to Business Marketing 1st Edition Robert Vitale

https://ebookfinal.com/download/business-to-business-marketing-1st-
edition-robert-vitale/
Python Business Intelligence Cookbook 1st Edition
Robert Dempsey Digital Instant Download
Author(s): Robert Dempsey
ISBN(s): 9781785287466, 178528746X
Edition: 1
File Details: PDF, 9.22 MB
Year: 2015
Language: english
Table of Contents
Python Business Intelligence Cookbook
Credits
About the Author
About the Reviewer
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
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Set Up to Gain Business Intelligence
Introduction
Installing Anaconda
Getting ready
How to do it…
Mac OS X 10.10.4
Windows 8.1
Linux Ubuntu server 14.04.2 LTS
How it works…
Learn about the Python libraries we will be using
Installing, configuring, and running MongoDB
Getting ready
How to do it…
Mac OS X
Windows
Linux
How it works…
Installing Rodeo
Getting ready
How to do it…
How it works…
Starting Rodeo
Getting ready
How to do it…
Installing Robomongo
Getting ready
How to do it…
Mac OS X
Windows
Using Robomongo to query MongoDB
Getting ready
How to do it…
Downloading the UK Road Safety Data dataset
How to do it…
How it works…
Why we are using this dataset
2. Making Your Data All It Can Be
Importing a CSV file into MongoDB
Getting ready
How to do it…
How it works…
There's more…
Importing an Excel file into MongoDB
Getting ready
How to do it…
How it works…
Importing a JSON file into MongoDB
Getting ready
How to do it…
Importing a plain text file into MongoDB
How to do it…
How it works…
Retrieving a single record using PyMongo
Getting ready
How to do it…
How it works…
Retrieving multiple records using PyMongo
Getting ready
How to do it…
How it works…
Inserting a single record using PyMongo
Getting ready
How to do it…
How it works…
Inserting multiple records using PyMongo
Getting ready
How to do it…
How it works…
Updating a single record using PyMongo
Getting ready
How to do it…
How it works…
Updating multiple records using PyMongo
Getting ready
How to do it…
How it works…
Deleting a single record using pymongo
Getting ready
How to do it…
How it works…
Deleting multiple records using PyMongo
Getting ready
How to do it…
How it works…
Importing a CSV file into a Pandas DataFrame
Getting ready
How to do it…
How it works…
There's more…
Renaming column headers in Pandas
Getting ready
How to do it…
How it works…
Filling in missing values in Pandas
Getting ready
How to do it…
How it works…
Removing punctuation in Pandas
Getting ready
How to do it…
How it works…
Removing whitespace in Pandas
Getting ready
How to do it…
How it works…
Removing any string from within a string in Pandas
Getting ready
How to do it…
How it works…
Merging two datasets in Pandas
Getting ready
How to do it…
How it works…
Titlecasing anything
Getting ready
How to do it…
How it works…
Uppercasing a column in Pandas
Getting ready
How to do it…
How it works…
Updating values in place in Pandas
Getting ready
How to do it…
How it works…
Standardizing a Social Security number in Pandas
Getting ready
How to do it…
How it works…
Standardizing dates in Pandas
Getting ready
How to do it…
How it works…
Converting categories to numbers in Pandas for a speed boost
Getting ready
How to do it…
How it works…
3. Learning What Your Data Truly Holds
Creating a Pandas DataFrame from a MongoDB query
Getting ready
How to do it…
How it works…
Creating a Pandas DataFrame from a CSV file
How to do it…
How it works…
Creating a Pandas DataFrame from an Excel file
How to do it…
How it works…
Creating a Pandas DataFrame from a JSON file
How to do it…
How it works…
Creating a data quality report
Getting ready
How to do it…
How it works…
Generating summary statistics for the entire dataset
How to do it…
How it works…
Generating summary statistics for object type columns
How to do it…
How it works…
Getting the mode of the entire dataset
How to do it…
How it works…
Generating summary statistics for a single column
How to do it…
How it works…
Getting a count of unique values for a single column
How to do it…
How it works…
Additional Arguments
Getting the minimum and maximum values of a single column
How to do it…
How it works…
Generating quantiles for a single column
How to do it…
How it works…
Getting the mean, median, mode, and range for a single column
How to do it…
How it works…
Generating a frequency table for a single column by date
Getting ready
How to do it…
How it works…
Generating a frequency table of two variables
Getting ready
How to do it…
How it works…
Creating a histogram for a column
Getting ready
How to do it…
How it works…
Plotting the data as a probability distribution
How to do it…
How it works…
Plotting a cumulative distribution function
How to do it…
How it works…
Showing the histogram as a stepped line
How to do it…
How it works…
Plotting two sets of values in a probability distribution
How to do it…
How it works…
Creating a customized box plot with whiskers
How to do it…
How it works…
Creating a basic bar chart for a single column over time
How to do it…
How it works…
4. Performing Data Analysis for Non Data Analysts
Performing a distribution analysis
How to do it…
How it works…
Performing categorical variable analysis
How to do it…
How it works…
Performing a linear regression
How to do it…
How it works…
Performing a time-series analysis
How to do it…
How it works…
Performing outlier detection
How to do it…
How it works…
Creating a predictive model using logistic regression
How to do it…
How it works…
Creating a predictive model using a random forest
How to do it…
How it works…
Creating a predictive model using Support Vector Machines
How to do it…
How it works…
Saving a predictive model for production use
Getting Ready
How to do it…
How it works…
5. Building a Business Intelligence Dashboard Quickly
Creating reports in Excel directly from a Pandas DataFrame
How to do it…
How it works…
Creating customizable Excel reports using XlsxWriter
How to do it…
How it works…
Building a shareable dashboard using IPython Notebook and
matplotlib
Getting Set Up…
How to do it…
How it works…
Exporting an IPython Notebook Dashboard to HTML
Getting Ready…
How to do it…
How it works…
See Also…
Exporting an IPython Notebook Dashboard to PDF
Getting Ready…
How to do it...
Method one…
Method 2…
Exporting an IPython Notebook Dashboard to an HTML slideshow
How to do it…
How it works…
Building your First Flask application in 10 minutes or less
Getting Set Up…
How to do it…
How it works…
See Also..
Creating and saving your plots for your Flask BI dashboard
How to do it…
How it works…
Building a business intelligence dashboard in Flask
How to do it…
How it works…
Index
Python Business Intelligence
Cookbook
Python Business Intelligence
Cookbook
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: December 2015

Production reference: 1111215

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78528-746-6
www.packtpub.com
Credits
Author

Robert Dempsey

Reviewer

Utsav Singh

Commissioning Editor

Nadeem Bagban

Acquisition Editor

Sonali Vernekar

Content Development Editor

Preeti Singh

Technical Editor

Siddhesh Patil

Copy Editor

Sonia Mathur

Project Coordinator

Shweta H. Birwatkar

Proofreader

Safis Editing
Indexer

Mariammal Chettiyar

Graphics

Disha Haria

Production Coordinator

Nilesh R. Mohite

Cover Work

Nilesh R. Mohite
About the Author
Robert Dempsey is a tested leader and technology professional
who specializes in delivering solutions and products to solve tough
business challenges. His experience of forming and leading agile
teams, combined with more than 16 years of technology experience,
enables him to solve complex problems while always keeping the
bottom line in mind.

Robert has founded and built three start-ups in tech and marketing,
developed and sold two online applications, consulted for Fortune
500 and Inc. 500 companies, and has spoken nationally and
internationally on software development and agile project
management.

He's the founder of Data Wranglers DC, a group that is dedicated to


improving the craft of data engineering, as well as a board member
of Data Community DC.

In addition to spending time with his growing family, Robert geeks


out on Raspberry Pi, Arduinos, and automating more of his life
through hardware and software.

Find him on his website at http://robertwdempsey.com.

I would like to thank my family for giving me the mornings, nights,


and weekends to write this book. Without their love and support
everything would be a lot harder. I'd also like to thank the
creators of Pandas, scikit-learn, matplotlib, and all the excellent
Python tools that allow us to do all that we do with data and have
fun at the same time. Finally, I'd like to thank the team at Packt
for giving me a platform for this book, and you for purchasing it.
About the Reviewer
Utsav Singh holds a BTech from Uttar Pradesh Technical University
and currently works as a senior software engineer at MAQ Software.
He is a Microsoft certified Business Intelligence developer, and he
has also worked on Amazon Web Services (AWS) and Microsoft
Azure. He loves writing reusable, scalable, clean, and optimized
code. He believes in developing software that keeps everyone happy
—programmers, clients, and end users.

He is experienced in AWS, Python, Django, Shell scripting, MySQL,


SQL Server, and C#. With help from these technologies and
extensive experience in business intelligence, he has been
designing and automating terabyte-scale data marts and
warehouses for the last three years.
www.PacktPub.com
Support files, eBooks, discount
offers, and more
For support files and downloads related to your book, please visit
www.PacktPub.com.

Did you know that Packt offers eBook versions of every book
published, with PDF and ePub files available? You can upgrade to
the eBook version at www.PacktPub.com and as a print book
customer, you are entitled to a discount on the eBook copy. Get in
touch with us at <service@packtpub.com> for more details.

At www.PacktPub.com, you can also read a collection of free


technical articles, sign up for a range of free newsletters and receive
exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is


Packt's online digital book library. Here, you can search, access, and
read Packt's entire library of books.

Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can
use this to access PacktLib today and view 9 entirely free books.
Simply use your login credentials for immediate access.
Preface
Data! Everyone is surrounded by it, but few know how to truly exploit
it. For those who do, glory awaits!

Okay, so that's a little dramatic; however, being able to turn raw data
into actionable information is a goal that every organization is
working to achieve. This book helps you achieve it.

Making sense of data isn't some esoteric art requiring multiple


degrees—it's a matter of knowing the recipes to take your data
through each stage of the process. It all starts with asking an
interesting question.

My mission is that, by the end of this book, you will be equipped to


apply Python to business intelligence tasks—preparing, exploring,
analyzing, visualizing, and reporting—in order to make more
informed business decisions using the data at hand.

Prepare for an awesome read, my friend!

A little context first. The code in this book is developed on Mac OS X


10.11.1, using Python 3.4.3, IPython 4.0.0, matplotlib 1.4.3, NumPy
1.9.1, scikit-learn 0.16.1, and Pandas 0.16.2—in other words, the
latest or near-latest versions at the time of publishing.
Discovering Diverse Content Through
Random Scribd Documents
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like