6 Ways Python Can Automate Tedious Processes for the Modern Marketer

Python for marketing

The world of marketing requires an ever-growing set of skills if you want to stay on top of your game. In my role as a Data Architect, that rule has remained strong throughout my 20+ year career and makes my job extremely enjoyable. There are very few aspects of my job that I dislike, but at the top of that short list is having to repeat tasks that, to me, are either mundane or arduous. In my opinion, my efforts are better spent automating such processes and learning new skills that I can apply to make my job more efficient. And if I can have fun in the process, well that’s just the icing on the nerdy cake.

Automation is nothing new at all. As a modern marketer, there almost seems to be an infinite number of platforms and utilities to automate and simplify. Need to dedupe your data? There are tools for that. Need to optimize your ROI? There are turnkey platforms to help you do that. Need to migrate off one platform and onto another? Well, that is a little more complicated, but we can definitely help with that.

My point is that there are many options to help you accomplish a single task, but very few that you can leverage to accomplish an incredibly significant portion of your marketing tasks.

Unless I am working in a specific tool like SQL Server or Excel, my go-to tool these days is Python. You may have heard of this programming language as it has quickly and strongly risen as a general favorite in several industries for its ability to handle just about anything. I recently heard a coworker mention that they wanted a solution to do everything for them — including vacuum their house. Now, vacuuming was mentioned partly in jest, but with some motors, a microprocessor, and a little more hardware, Python would be capable of doing that just that (search on “micropython” if you want to really geek out).

Now, I’m not going to say that Python is the greatest programming language ever. That would be like going to Comic-Con and shouting that Iron Man is the greatest superhero ever. While Iron Man may be your favorite superhero, there are definitely going to be others who cast their vote for Superman, Thor, or Captain America — and feel very strongly about it.

However, as someone who has had the pleasure of developing program solutions for a couple of decades, I have had the pleasure, and displeasure, of acclimating myself with many languages. Python is hands down one of the easiest and most versatile languages to learn and apply to my day-to-day activities. It literally saves me days of work every year and allows me to build upon other skills.

What exactly is Python?

Without going into great detail, Python is a scripting language that can run on any popular operating system (e.g., Windows, MacOS, Linux). If you are not familiar with the term “scripting language,” all that means is that an interpreter (an executable program, called python or python.exe depending on your OS) is executed in order to run the plain text scripts containing the Python code that you (or a programmer) create. The interpreter basically analyzes your Python code and then processes the instructions in your Python file.

Scripting languages do not require you to compile your code into what is called a “machine language” that computers can understand more quickly. So, there is a bit of a performance trade-off when using any scripting language. Generally, however, it is much faster to develop a solution in a scripting language and — bonus — it does not require you to compile the code for a specific OS. The Python code you create on a Windows machine, for example, will work on a Mac.

So, how can marketers use Python to make their lives easier?

Just about any way you can think of, but I’ll give you some examples:

  1. Predictive Analytics/Data Modeling

Have a need for regression analysis to more accurately calculate campaign attribution or derive a more robust lead score algorithm? Python is a popular (and free option) to make the most of your existing Opportunity and Campaign Response data. It also offers more functionality and is much easier to use than Microsoft® Excel. Plus, you can take advantage of the existing stat libraries shared by other Python users to quickly apply their code to your data — or use it as a jumping off point should you need to make some adjustments.

Related libraries: pandas, sklearn, SciPy, TensorFlow, keras

  1. Data Processing

Python has native structures and open-source libraries that support just about any data processing task that you can think of (this is not an exaggeration!). Need to quickly rename or modify the contents of text or html files? Need to move files into specific folders based on file type, name, or content? A Python script can perform these tasks with just a few lines of code.

Related libraries: pandas, numpy, psycop, pyodbc

  1. Web Scraping

Want to better understand how your web content is performing? A simple Python script can extract and analyze web content for your SEO analysis, market analysis, and lead targeting efforts.

Related libraries: Beautiful Soup, requests, urllib, Selenium

  1. Custom API Integrations

Need to merge data across your sea of MarTech platforms? Through the use of some standard Python libraries, you can easily connect to platform APIs, such as those for Salesforce, Marketo, and Eloqua (just to name a few) to extract and merge pertinent reporting data points. That’s not to say that every API is easy to deal with. Ease of API use is controlled by the architects who developed the API and which platform features they elected to expose via the API. But, most APIs do allow you to extract information in bulk in some fashion.

Related libraries: One of my favorite and most utilized libraries is marketo-rest-python

  1. Platform Migrations

I have been involved in many projects in the past two years where clients have migrated contacts, assets, and activities (to some degree) from one MAP instance to another (e.g., Marketo to Marketo, Eloqua to Marketo, Pardot to Eloqua). This process generally involves extracting data/assets from one platform instance, sometimes transforming the data (standardizing job titles or updating form/email/landing page links), and then pushing the data/assets to the other platform instance. The beauty of APIs is that they typically expose the features and capabilities of a platform programmatically to a great degree, and we are able to leverage APIs to perform these migrations quickly and reliably.

Related libraries: Specific to each individual platform

  1. Website/Web App Development

Python has a few libraries and frameworks that enable you to build websites and web applications quickly, and with many great features such as preconfigured user login and permissioning.  Django, for example, is a popular framework for Python that was used to build Instagram, Spotify, YouTube, and Instagram.

Related libraries: flask, Django

To check out the individual libraries I shared above, search on “python” and the library name. Alternatively, the Python Package Index is a comprehensive repository where you can find documentation and code that’s already been developed and shared by the Python community. Just search on the library you’re interested in and you’ll find an overview of what it can do, along with a release history, file downloads, and a link to the source code on GitHub.

One of the most helpful online references that I’ve come across is “Automate the Boring Stuff with Python.” Part 1 provides you with a nicely detailed intro to Python. Part 2 contains many practical examples, such as reading and writing to files, web scraping, working with Microsoft Excel/Google Sheets, and manipulating images — just to name a few. You can also download the book for free.

Wondering if Python can simplify your everyday workload or help you out with a special project?  I encourage to you to give Python a look. Or, contact us. We’re leveraging Python solutions — and creating custom ones — on a daily basis to make life easier not only for our clients’ marketing teams, but also our own.



Rick Segura Data Architect DemandGen Headshot
Rick Segura, Data Architect, is a vastly experienced data guru. Having 20+ years of database experience, Rick is a master of ETL (data processing), data merging & aggregation, report & dashboard development, data analysis, and automation. He is very passionate about delivering intuitive, purposeful data-based solutions.

The post 6 Ways Python Can Automate Tedious Processes for the Modern Marketer appeared first on DemandGen.

About the Author

Rick Segura

Rick Segura, Data Architect at DemandGen, is a vastly experienced data guru. Having 20+ years of database experience, Rick is a master of ETL (data processing), data merging & aggregation, report & dashboard development, data analysis, and automation. He is very passionate about delivering intuitive, purposeful data-based solutions.

More Content by DemandGen
Previous Article
A Project Management Tool Can Make All the Difference When It Comes to Meeting Your Marketing Goals
A Project Management Tool Can Make All the Difference When It Comes to Meeting Your Marketing Goals

As a senior campaign manager, I need to keep my finger on the pulse of several projects at once. Based... T...

Next Article
What Many Companies Overlook with Their Demand Generation Strategy
What Many Companies Overlook with Their Demand Generation Strategy

A number of years ago I sat in a conference room of a Fortune 500 company speaking with a number... The pos...