Book Image

Data Science for Marketing Analytics - Second Edition

By : Mirza Rahim Baig, Gururajan Govindan, Vishwesh Ravi Shrimali
Book Image

Data Science for Marketing Analytics - Second Edition

By: Mirza Rahim Baig, Gururajan Govindan, Vishwesh Ravi Shrimali

Overview of this book

Unleash the power of data to reach your marketing goals with this practical guide to data science for business. This book will help you get started on your journey to becoming a master of marketing analytics with Python. You'll work with relevant datasets and build your practical skills by tackling engaging exercises and activities that simulate real-world market analysis projects. You'll learn to think like a data scientist, build your problem-solving skills, and discover how to look at data in new ways to deliver business insights and make intelligent data-driven decisions. As well as learning how to clean, explore, and visualize data, you'll implement machine learning algorithms and build models to make predictions. As you work through the book, you'll use Python tools to analyze sales, visualize advertising data, predict revenue, address customer churn, and implement customer segmentation to understand behavior. By the end of this book, you'll have the knowledge, skills, and confidence to implement data science and machine learning techniques to better understand your marketing data and improve your decision-making.
Table of Contents (11 chapters)
Preface

2. Data Exploration and Visualization

Activity 2.01: Analyzing Advertisements

Solution:

Perform the following steps to complete this activity:

  1. Import pandas and seaborn using the following code:

    import pandas as pd

    import seaborn as sns

    import matplotlib.pyplot as plt

    sns.set()

  2. Load the Advertising.csv file into a DataFrame called ads and examine if your data is properly loaded by checking the first few values in the DataFrame by using the head() command:

    ads = pd.read_csv("Advertising.csv", index_col = 'Date')

    ads.head()

    The output should be as follows:

    Figure 2.65: First five rows of the DataFrame ads

  3. Look at the memory usage and other internal information about the DataFrame using the following command:

    ads.info

    This gives the following output:

    Figure 2.66: The result of ads.info()

    From the preceding figure, you can see that you have five columns with 200 data points in each and no missing values.

  4. Use describe() function to view basic statistical details...