Book Image

The Art of Data-Driven Business

By : Alan Bernardo Palacio
Book Image

The Art of Data-Driven Business

By: Alan Bernardo Palacio

Overview of this book

One of the most valuable contributions of data science is toward helping businesses make the right decisions. Understanding this complicated confluence of two disparate worlds, as well as a fiercely competitive market, calls for all the guidance you can get. The Art of Data-Driven Business is your invaluable guide to gaining a business-driven perspective, as well as leveraging the power of machine learning (ML) to guide decision-making in your business. This book provides a common ground of discussion for several profiles within a company. You’ll begin by looking at how to use Python and its many libraries for machine learning. Experienced data scientists may want to skip this short introduction, but you’ll soon get to the meat of the book and explore the many and varied ways ML with Python can be applied to the domain of business decisions through real-world business problems that you can tackle by yourself. As you advance, you’ll gain practical insights into the value that ML can provide to your business, as well as the technical ability to apply a wide variety of tried-and-tested ML methods. By the end of this Python book, you’ll have learned the value of basing your business decisions on data-driven methodologies and have developed the Python skills needed to apply what you’ve learned in the real world.
Table of Contents (17 chapters)
1
Part 1: Data Analytics and Forecasting with Python
4
Part 2: Market and Customer Insights
9
Part 3: Operation and Pricing Optimization

Finding changes in search trend patterns

Search trends are not a static variable; in fact, they change and vary over time. We will get the results of the interest by region in the last 3 months and then we will look at changes in the results compared to the ones obtained over a period of 12 months:

  1. To find the changes in search trends patterns, we will build the payload within a different timeframe.
  2. Finally, we will store the results in a pandas DataFrame named regiondf_3m:
    #search interest per region
    pytrend = TrendReq()
    pytrend.build_payload(kw_list, timeframe='today 3-m')
    # Interest by Region
    regiondf_3m = pytrend.interest_by_region()
  3. We need to remove the rows that don’t have results for the search terms specified:
    # #looking at rows where all values are not equal to 0
    regiondf_3m = regiondf_3m[regiondf_3m.sum(axis=1)!=0]
  4. Now, we can visualize the results using the plot method of the pandas DataFrame:
    # visualize
    regiondf_3m.plot(figsize=(14, 8), y=kw_list...