Python Script: Automatically Cluster Keywords in Bulk for Actionable Insights V2

Table of Contents

Today I’d like to share a Python script to automatically generate keyword clusters for all keywords yours or your competitors’ Website ranks for. This provides deep insights and otherwise hidden patterns in your keywords data at a glance.

If you’d just like to get started you can download the Google Colab here.

Why Cluster At All?

Clustering keywords can provide powerful insights to yours and your competitors data. It can be useful for:

  • Filtering out junk keywords in bulk from your keyword lists
  • Finding the most profitable keyword clusters of your competitors site
  • Find ideas for content hubs by clustering similar questions together

Supported Files

Script Features

  • 100% Automated Keyword Clustering
  • Calculates the Median CPC Per Cluster
  • Calculates the Median Difficulty Per Cluster
  • Calculates the Sum of Estimated Traffic Per Cluster
  • Calculates the Sum of Estimated Search Volume Per Cluster

Script Output

Here’s a small sample of the script output using – You can see it has neatly clustered loungewear and curtains together and calculated the total volume of the cluster. Awesome!


When prompted, upload your keyword file in .CSV format.

That’s it! The script will run and download a clustered CSV file to your downloads folder!

Scroll to Top