Image by Brian Ego from Pixabay

Are you sick of having to painstakingly scroll through a Google Analytics CSV document full of 100s of keywords just to find the search volume of 5 specific keywords?

Maybe you’d like to learn how to make a spectacular graph chart that shows the search volume for five keywords over the course of 2 years – just through the magic of Python code?

But maybe you’re not really a coder? Perhaps the thought of coding is enough to make the hair on the back of your neck stand up?

In this series, I’m going to show you how to use Python for digital marketing – even if you have no previous coding experience.

First and foremost though, we need to get everything set up properly.

In this blog post, you’ll learn:

– Why you should learn Python.

– How to install Python 3.

– How to install PyCharm

– How to install external libraries.

What you’ll need:

– A desktop or laptop running Windows or Mac OS.

– A connection to the Internet.

Why learn Python?

python-vs-other-coding languages

Image by GoodHead4Media from Pixabay

Maybe you’re still on the fence about why you should choose Python over some of the other programming languages, like C# or Java.

After all, C# has official support from Microsoft, and Java is the most popular coding language (source: Stackify.com)

If you’re still not convinced, here are 3 reasons why you should learn Python.

1. Python’s Syntax Is Easy

If you’re new to the world of coding, then reading a piece of code can feel like reading a chunk of text in an unfamiliar language – very intimidating.

To prove my point, I want you to take a look at this Java code snippet:

 

System.println.out(“Hello World”)

 

Know what that piece of code does? It prints out “Hello World.” That’s it. Quite complicated for such a simple task.

Now, compare it to the Python equivalent:

 

print("Hello World")

 

If you have little to no coding experience, there’s no better programming language to start with than Python. After you’ve learned the basics, the syntax is easy to comprehend for the most part.

2. Python is Versatile

python-code-snippet

Image by Johnson Martin from Pixabay

What do Google, Wikipedia, and Netflix have in common? They’re all tech giants, yes. But, they also have another thing in common – they all use Python.

Despite its seemingly simplistic syntax, Python is a versatile coding language that can be used for everything from data science, making games, and creating graphs for data visualization (something we’ll cover in future entries in this series). 

 

3. Python is Portable & Open Source

C# might have official support from Microsoft, but what good is that support if you’re running Mac OS?

Whether you’re using Microsoft Windows, Apple OS, or even Ubuntu, the good news is that Python will run on all of them.

Also, because Python is open source, new tools and libraries are created for it regularly. Oh, and did I mention you don’t need to pay a license fee to use it?

Installing Python

Microsoft Windows

 

1. Visit Python.org, and download the latest Windows installation package of Python 3.

2. Once the download process has finished, run the .exe file. Remember to check the boxes for “Add Python to PATH” before installation.

 

python installer window

3. Follow the installation instructions.

Mac OS

 

  1. Visit Python.org, and download the latest Macintosh installation package of Python 3 (found at the top, under “Stable Releases”) by clicking on “Download macOS 64-bit installer”.
  2. Once the download has finished, run the .pkg file, making sure that the checkbox for “Add Python to PATH” is checked before you start the installation.
  3. Follow the instructions.

Installing PyCharm

Good work – you’ve installed Python! Next, we’ll install a code editor to write our programs in.

A code editor is sometimes called an “integrated development environment” (or “IDE”). For these tutorials, I’ll be using PyCharm.

You’re certainly free to choose any code editor, but if you’re looking for one that will immediately highlight any typos or mistakes in your code and which will let you run your code directly in the code editor, I recommend PyCharm.

 

Windows and Mac OS

1. Go to pycharm.com, and click on “Download”.

2. Select the installer for your operating system, and download the “Community” version.

 

pycharm download page

3. Once the download has finished, open the installation file and follow the instructions.

NOTE: While the Professional Edition of PyCharm offers tools for e.g. web development and other goodies, the Community Edition is all you’ll need.

Installing Python Libraries

In Python, a “library” is a collection of modules used for a certain task. Some examples of libraries include:

 

  • MathPy – used for mathematical calculations.
  • Os – used for conducting commands through the operating system (e.g. creating a folder).
  • TensorFlow – used for machine learning.

Some of these libraries are installed with Python. However, the ones we’ll use in this series need to be installed manually.

Don’t worry – you can do this using your computer’s command prompt.

The libraries we’ll use are:

 

  • pandas – used for data analysis
  • pytrends – used for downloading reports from Google Trends
  • matplotlib – used for creating graphs, charts, and other visualizations

Windows

1. Open the Windows Command Prompt.

2. Once the Command Prompt is open, enter the following command to install the “pandas” library:

pip install pandas

command prompt pip install

3. Repeat Step 2 for the “pytrends” and “matplotlib” libraries.

Mac OS

1. Open the Macintosh Terminal.

2. Enter the following command in the terminal to install the “pandas” library:

pip install pandas

3. Repeat Step 2 for the “pytrends” and the “matplotlib” libraries.

Further explained:

– “pip” is the Python package and library installer. When you enter “pip install” in your command prompt, you’re telling the computer to install an external Python library using pip.

– “pandas” is the name of the library you want to install.

NOTE: pip will only work if Python is installed. To verify whether Python is installed, enter the following command in your command prompt:

python --version (Windows)

python -version (Mac OS)

If Python is installed on your computer, the terminal will return “Python,” followed by the version number. It might look something like this:

verify python version in command prompt

If you’ve installed a much more recent version, your output might be different. The important thing is that the terminal window returns “Python” and the version number.

Conclusion

Way to go; you’re done!

In the next lesson, we’ll look at some general programming terminology, as well as getting you started on your first project.

Struggling to explain your technical product or service as straightforward as this blog post?

Would you like to get rid of the confusing fluff and jargon in favor of something that will make your readers go, “Oh, I get it now!” after they’ve read it?

Then, contact me today, and let’s talk some more.