Python for Marketers
Basic lessons and resources to pick up this technical skill fast — and why you should
Learning a programming language when you do online advertising is not the most obvious thing to do. I mean, let’s face it, there are plenty of different opportunities to develop yourself without going to a completely different industry.
But if you already made up your mind to learn Python, you probably face a very common issue: There are not enough materials on the internet that can guide you through this programming world.
Don’t get me wrong. Programming is probably the dominant industry on the web, with millions of free and paid educational materials. But this benefit makes finding the right course challenging. Where to start? What should I learn?
I spent seven years doing online marketing and the last two years dedicated to marketing automation and analysis, so I have some practical advice based on my own experience. But first, let’s understand why you should or shouldn’t learn Python.
Python Is Not a Universal Answer
Although Python is becoming the number one popular language in the world, it’s not easy to master. The good news is that you don’t need to be a Python expert. Your career is online advertising; Python is just an instrument to make your profile stronger. It shouldn’t be your number one concern.
As with a lot of other instruments, Python has several primary focus areas that will boost your performance and a ton of others that aren’t relevant to you at all. For example, things like performance optimization, parallelism, and asynchronous implementation make you sound smart, but they are entirely, or mostly, irrelevant.
To make your journey through the study of Python enjoyable, you first need to identify areas that you can use in everyday work. Everything you can’t implement and try on a real project becomes redundant and is forgotten.
In my opinion, depending on your fields of work, you might want to choose one of the following directions:
- Report automation — If you have a lot of different data to gather and process but you’re tired of doing it manually, Python might be just the right thing for you.
- Campaign automation — Sometimes you work with ecommerce or startups that have thousands or even millions of different products, SKUs, or geo areas to work with. Building and updating campaigns manually might be a huge pain. Python is convenient in this case.
- Data analysis — A lot of fundamental data analysis and A/B testing can be done with Google Analytics or similar tools. But if you want to generate keyword negatives, find user behaviour patterns, understand which triggers force users to make the right decisions, Python is just the right instrument.
There are also plenty of other options that are very useful for marketers. For example, basic machine learning can help a lot with everything from landing page optimization to Facebook and Google Ads targeting adjustments. But it’s the wrong topic to start with when learning Python — it’s just too complicated.
I even once built a Slack bot that gave me instant access to campaign performance. But again, I used that project as an underlying task to fix my knowledge about report automation and data analysis.
My recommendation to you is to pick the single problem from your everyday life that takes the most amount of your time and try to optimize it. It usually takes time until you can build a beautiful project from scratch, so it’s better to start with what troubles you every single day.
A Very Short List of Things You Really Need to Learn
No matter which path you chose, the beginning of the journey remains the same. Python is an object-oriented programming language. This sentence probably doesn’t give you any information. But it’s essential to have a good introduction to how the programming on Python looks in general.
Your very first step should be a nicely made general course or book that can introduce you to the language. Don’t be scared — Python is very human-readable.
For example, you can easily understand this code without having any additional background knowledge.
campaigns_stats_by_day = get_campaigns_stats(start_date=”01–01–2020", end_date=”31–01–2020", by=”day”)campaigns_stats_total = campaigns_stats_by_day.groupby(by=”Campaign Name”).sum()campaigns_stats_total.to_excel(name=”My nice campaign report.xlsx”)
But even if it looks complicated, it won’t be after you take your first step.
I can advise you on one excellent course and one very human-friendly book. I read the book first and then went for the course. I find that’s the right approach because it gives you a better understanding by covering similar topics from different perspectives. But it’s up to you to decide where to start, based on your level.
The book is “Introducing Python: Modern Computing in Simple Packages” by Bill Lubanovic. It’s a very short and helpful introduction for those who have no or some experience.
The course is Coursera’s “Python for Everybody,” It’s run by Michigan University and is very simple, with some real-life examples.
After you finish this course, you should expect two things, one good and one bad. The good one: You are now able to write code in Python, and it works. The bad one: You’re standing at your first learning gap.
A learning gap is a time in your education when you have enough base knowledge to combine simple tasks, but you don’t have enough practice to build a small project on your own. Now it’s the time for step two.
Learn Python by Practice: pandas Practice
It took me six months to go through the learning gap because I couldn’t make myself sit and find materials to build a project. I always tried to build something big and self-sufficient. And it was my biggest mistake. I encourage you not to make such a mistake by cutting corners.
Don’t try to make a program that does all the stuff for you. Concentrate on one simple problem and skip complicated things. For instance, usually, it isn’t elementary to download data directly from advertising or analytical tool to your Python script, at least at the beginning.
Downloading an Excel or CSV report from Google or Facebook interface and loading it to Python is much simpler. Don’t worry, as soon as you nail working with downloaded reports, you can move forward to download data automatically. On the other hand, if you start with solving a downloading problem, you might become stuck before having any results you can touch and try.
In most of Python plus marketing tasks, you need to work with some tables. And Python has one of the best libraries in the world to do it: pandas.
Pandas is a simple, fast, and easy-to-learn library that helps you implement almost any data analysis on data that’s in a table format. The only thing you need to remember is this: Don’t use any merged cells.
Start learning pandas with YouTube. In my opinion, it has the best set of ready-to-go videos on how to do it. You also can try Coursera or Udemy, but you might end up with a lot of statistics tasks that are irrelevant to this step.
Here is an example of the tasks you might want to do:
- Calculate the overall spend and conversion for a given period
- Find the worst-performing keywords or ads
- Find the best-performing ad groups
- Make a pivot table with campaign names and stats from the more granular report. For example, ads, ad group, or keyword report might be very useful.
You’ll need to practice how to do the following in pandas DataFrame:
- Load data from CSV or Excel
- Create a new column
- Rename columns
- Round values in a column
- Group by column
- Filter by column
I intentionally didn’t put a detailed guide here on how to perform these actions so that you can practice how to resolve problems on your own.
Python is not a complicated language to learn. As usually happens with new skills, though, it requires time and effort in the beginning. The best way to nail it is to identify an achievable goal and to try to resolve it.
By moving step by step and cutting out irrelevant and overcomplicated questions, you can bring huge benefits to your everyday life as a marketing professional.
Start your journey with a proper introduction using the book and course I mentioned above, and then try to build your own small project.
And most importantly, if you struggle with something, don’t hesitate to ask. As Steve Jobs once said:
“Now, I’ve actually always found something to be very true, which is most people don’t get those experiences because they never ask. I’ve never found anybody who didn’t want to help me when I’ve asked them for help.” — Steve Jobs