How to bin data in Pandas with cut() and qcut()

Whether you call it data binning, data bucketing, or data discretization, the technique of grouping numeric data together is an exceptionally powerful one in data science, statistics, and machine learning....

How to calculate the profitability of BOGOF and multibuy promotions

Buy One Get One Free or BOGOF promotions, and similar multibuy promotions that provide a free item when customers purchase over a specified amount are very common in retailing, including...

How to analyse ecommerce coupon uplift with GAPandas

In ecommerce, coupons, voucher codes, or discount codes are widely used for meeting a range of different sales objectives. They can encourage new customers to make their first purchase, encourage...

How to use CSS and XPath custom extraction in Advertools

The Advertools web scraping package popular in the Python SEO community automatically extracts a wide range of page elements, such as the title, meta description, and various schema.org and OpenGraph...

How to scrape a website using Advertools

For larger web scraping projects, the Scrapy web scraping Python package is one of the most effective tools. It’s powerful and fast and have a huge range of features. However,...

How to query the Google Analytics Data API for GA4 using Python

Google recently announced that it will be sunsetting Universal Analytics and replacing it with Google Analytics 4. The news sent shock waves through the ecommerce and marketing world, as it...

How to get a list of the dimensions and metrics in your GA4 property

Google Analytics 4 uses a completely different set of dimensions and metrics to Google Analytics 3 or Universal Analytics. In this project I’ll show you how to get back a...

How to create an ABC customer segmentation in Pandas

ABC classification is a simple technique that is commonly used in inventory management and is based on the Pareto principle or 80/20 rule. This says that 80% of consequences come...

How to rename columns in Pandas dataframes

Renaming Pandas dataframe columns is a common task for the data scientist. Neat, consistent column names make your dataframe easier to read and your code cleaner to write and maintain....