Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Data Science for Marketing Analytics
Data Science for Marketing Analytics

Data Science for Marketing Analytics: Achieve your marketing goals with the data analytics power of Python

Arrow left icon
Profile Icon Blanchard Profile Icon Behera Profile Icon Pranshu Bhatnagar
Arrow right icon
$29.99
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.8 (5 Ratings)
eBook Mar 2019 420 pages 1st Edition
eBook
$29.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Blanchard Profile Icon Behera Profile Icon Pranshu Bhatnagar
Arrow right icon
$29.99
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.8 (5 Ratings)
eBook Mar 2019 420 pages 1st Edition
eBook
$29.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$29.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Data Science for Marketing Analytics

Chapter 2. Data Exploration and Visualization

Note

Learning Objectives

By the end of this chapter, you will be able to:

  • Create summaries, aggregations, and descriptive statistics from your data

  • Reshape pandas DataFrames to detect relationships in data

  • Build pivot tables and perform comparative analysis and tests

  • Create effective visualizations through Matplotlib and seaborn

Note

This chapter explains how to derive various descriptive statistics and generate insights and visualizations from your data.

Introduction


In the previous chapter, we saw how to transform data and attributes obtained from raw sources into expected attributes and values through pandas. After structuring data into a tabular form, with each field containing the expected (correct and clean) values, we can say that this data is prepared for further analysis, which involves utilizing the prepared data to solve business problems. To ensure the best outcomes for a project, we need to be clear about the scope of the data, the questions we can address with it, and what problems we can solve with it before we can make any useful inference from the data.

To do that, not only do we need to understand the kind of data we have, but also the way some attributes are related to other attributes, what attributes are useful for us, and how they vary in the data provided. Performing this analysis on data and exploring ways we can use it, is not a straightforward task. We have to perform several initial exploratory tests on our data...

Identifying the Right Attributes


Given a structured marketing dataset, the first thing you should do is to try and build intuition for the data and create insights. It is also possible to make a call on whether a certain attribute is required for the analysis or not. The insights generated should instinctively agree with the values and there should be no doubts about the quality of the data, its interpretation, or its application for solving the business problems we are interested in. If some values don't make intuitive sense, we must dig deeper into the data, remove outliers, and understand why the attribute has those values. This is important in order to avoid inaccurate model creation, building a model on the wrong data, or the inefficient use of resources.

Before we start with the model creation, we should summarize the attributes in our data and objectively compare them with our business expectations. To quantify business expectations, we generally have target metrics whose relationships...

Generating Targeted Insights


Once we have identified the KPIs for our analysis, we can proceed to make insights with respect to only those variables that affect the bottom line of the KPIs.

Selecting and Renaming Attributes

After we have explored our attributes, we might feel like the variation in the data for a certain attribute could be understood more clearly if it were focused on individually. As explained in detail in the previous chapter, we can select parts of data in pandas through the following methods:

  • [cols]: This method selects the columns to be displayed.

  • loc[label]: This method selects rows by label or Boolean condition.

  • loc[row_labels, cols]: This method selects rows in row_labels and their values in the cols columns.

  • iloc[location]: This method selects rows by integer location. It can be used to pass a list of row indices, slices, and so on.

For example, we can select Revenue, Quantity, and Gross Profit columns from the United States in the sales DataFrame, as follows:

sales...

Visualizing Data


An important aspect of exploring data is to be able to represent the data visually. When data is represented visually, the underlying numbers and distribution become very easy to understand and differences become easy to spot.

Plots in Python are very similar to those in any other paradigm of traditional marketing analytics. We can directly make use of our previous understanding of plots and use them in Python. pandas supports inbuilt functions to visualize the data in them through the plot function. You can choose which ones are which via the kind parameter to the plot function. Some of the most commonly used ones, as used on sales.csv, are as follows:

  • kde or density for density plots

  • bar or barh for bar plots

  • box for boxplot

  • area for area plots

  • scatter for scatter plots

  • hexbin for hexagonal bin plots

  • pie for pie plots

You can specify which values to pass as the x and y axes by specifying the column names as x and y in the DataFrames.

Exercise 9: Visualizing Data With pandas...

Summary


In this chapter, we have explored the way data is processed and have figured out intuitive details about it. We can now perform advanced analysis and create visualizations to make processing easy to understand. We can use the knowledge that we have gained to solve further problems, explore hidden relationships, and do further analysis easily. Let's look at some applications of this with problems we can solve in the next chapter.

Left arrow icon Right arrow icon

Key benefits

  • Study new techniques for marketing analytics
  • Explore uses of machine learning to power your marketing analyses
  • Work through each stage of data analytics with the help of multiple examples and exercises

Description

Data Science for Marketing Analytics covers every stage of data analytics, from working with a raw dataset to segmenting a population and modeling different parts of the population based on the segments. The book starts by teaching you how to use Python libraries, such as pandas and Matplotlib, to read data from Python, manipulate it, and create plots, using both categorical and continuous variables. Then, you'll learn how to segment a population into groups and use different clustering techniques to evaluate customer segmentation. As you make your way through the chapters, you'll explore ways to evaluate and select the best segmentation approach, and go on to create a linear regression model on customer value data to predict lifetime value. In the concluding chapters, you'll gain an understanding of regression techniques and tools for evaluating regression models, and explore ways to predict customer choice using classification algorithms. Finally, you'll apply these techniques to create a churn model for modeling customer product choices. By the end of this book, you will be able to build your own marketing reporting and interactive dashboard solutions.

Who is this book for?

Data Science for Marketing Analytics is designed for developers and marketing analysts looking to use new, more sophisticated tools in their marketing analytics efforts. It'll help if you have prior experience of coding in Python and knowledge of high school level mathematics. Some experience with databases, Excel, statistics, or Tableau is useful but not necessary.

What you will learn

  • Analyze and visualize data in Python using pandas and Matplotlib
  • Study clustering techniques, such as hierarchical and k-means clustering
  • Create customer segments based on manipulated data
  • Predict customer lifetime value using linear regression
  • Use classification algorithms to understand customer choice
  • Optimize classification algorithms to extract maximal information

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 30, 2019
Length: 420 pages
Edition : 1st
Language : English
ISBN-13 : 9781789952100
Category :
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning

Product Details

Publication date : Mar 30, 2019
Length: 420 pages
Edition : 1st
Language : English
ISBN-13 : 9781789952100
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 141.97
Hands-On Data Analysis with Pandas
$48.99
Hands-On Data Science for Marketing
$48.99
Data Science for Marketing Analytics
$43.99
Total $ 141.97 Stars icon

Table of Contents

9 Chapters
Data Preparation and Cleaning Chevron down icon Chevron up icon
Data Exploration and Visualization Chevron down icon Chevron up icon
Unsupervised Learning: Customer Segmentation Chevron down icon Chevron up icon
Choosing the Best Segmentation Approach Chevron down icon Chevron up icon
Predicting Customer Revenue Using Linear Regression Chevron down icon Chevron up icon
Other Regression Techniques and Tools for Evaluation Chevron down icon Chevron up icon
Supervised Learning: Predicting Customer Churn Chevron down icon Chevron up icon
Fine-Tuning Classification Algorithms Chevron down icon Chevron up icon
Modeling Customer Choice Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.8
(5 Ratings)
5 star 20%
4 star 0%
3 star 40%
2 star 20%
1 star 20%
Asish May 19, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book has explained many of the fundamental topics in an intuitive and excellent way, particularly classification topicsI recommend this book to anyone involved in fundraising or investment of money. It's a good book to learn Python and usages in market analysis. I went through the various topic of this book and the topics are explained in a quite simple manner. Give it a try and own this book.
Amazon Verified review Amazon
William. Nov 15, 2020
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
overall, this is an organized and easy to read guide book for marketing analysis with python. Yet, lots of error - with coding introductions - in this book. need to be careful when you read and practice with this book.
Amazon Verified review Amazon
Brij May 19, 2019
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Find the book quite insightful and very well written with more focus on pragmatic examples and case studies rather than rigorous formulas and proofs. Recommend this to anyone in analytics field and wish to learn more about ML way of handling Marketing problems.
Amazon Verified review Amazon
Kindle Customer Aug 13, 2020
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
Not good. Badly written.
Amazon Verified review Amazon
Jinx Sep 11, 2021
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
Badly written with numerous errors. There're many better choices out there. Don't waste your time in this book.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.