Starting with Python

Before we actually start writing code, we need to download and install Python and then pick a code editor. That’s what we’ll cover in this short post.

Installing Python

Step 1: Download Python

  1. Go to python.org.
  2. Download the latest version for your operating system (Windows, macOS, or Linux).
  3. During installation, make sure to check the box that says “Add Python to PATH.”
  • This makes sure you can run Python from the command line without extra setup.

Step 2: Verify the Installation

Let’s check that Python was installed correctly.

  • On Windows: Open Command Prompt (search for cmd in the Start Menu).
  • On Mac: Open Terminal (search for Terminal in Spotlight Search).

Type this command:

python --version

If everything worked, you’ll see the version number printed.

Troubleshooting Installation Issues

If something doesn’t go quite right, don’t worry—there are plenty of other guides to walk you through it.

Here are some useful guides from geeksforgeeks:

Choosing an Editor

Python code can be written in a bunch of different editors. Try a few out and see what feels right.

  • Jupyter Notebook – Great for beginners and especially good for data analysis.
  • VS Code – An editor with excellent Python support. This is my go-to because I use multiple languages. It is extensible, so you can add plugins and customize it however you like.
  • IDLE– Python’s built-in editor. It’s basic, but it does the job.
  • PyCharm – PyCharm is built specifically for Python. Great if you’re doing bigger projects.

Running Python Code

There are several ways to run Python:

  1. In a script – Save your code in a .py file and run it.
  2. In a Jupyter Notebook – Great for running code one chunk at a time.
  3. In the terminal/command prompt – You can run Python interactively right from the command line.

Try this simple command in  whichever setup you choose:

print("Hello, Python!")

If you see that message printed back to you, you’re good to go!

What’s Next?

In the next post, we’ll introduce variables. After that, we’ll take a look at the fictional dataset we’ll be using throughout the series.

See you in the next one!

Recommended Python Books

What Is Python?

Python is a popular programming language – it is used in many industries and used for a variety of things. I have written a bit about it before. See here when I was trying to understand if Python is easier to learn than R.

Python is known for its simplicity, readability, and versatility. Because it is a general-purpose language, it can be used for many different types of programming, including data analysis, web development, automation, and machine learning.

See below for a list of what Python can be used to accomplish.

Data Analysis, Data Visualization, and Model Building

This blog series will focus mostly on Python for data analysis and will cover a range of topics like analyzing data with Pandas and NumPy and creating visualizations with Matplotlib and Seaborn.

We will also go over some important topics in model building. Although Python can be used to develop AI models using Scikit-Learn and TensorFlow, we will focus on much simpler models in this series.

Python is also a great tool for automating repetitive tasks. However, we will not cover much of this. It is good to know that Python can writes scripts to automate things like renaming files or processing data.

Web development is another area where Python excels, as it can also be used to create websites and web apps with frameworks like Flask and Django.

Python is also widely used in penetration testing and cybersecurity (think ethical hacking). We will not cover this aspect at all.

Because of its versatility, applications of Python extend beyond data science and web development and can include:

  • Game development with Pygame.
  • Building desktop applications with Tkinter.
  • Writing scripts for system administration and networking

Python is one of the most commonly used languages in data analysis, which makes it an excellent choice if you are just starting to work with data. It is also one of the better languages to learn if you are new to programming.

In the next post, we’ll go over how to install Python.

Recommended Python Books

Let’s Learn Python. Finally!

If you are here, it means you’re interested in learning Python! That’s great! I’ve put it off for a while and now i’m getting into it.

People say Python is one of the easiest programming languages to learn, but I’m still not sure about that. Easy is relative. However, if you want to improve your programming skills or desire to get into data science or machine learning, Python is a great place to start.

I often work with Stata and R but I have recently chosen to learn Python programming–starting first with an area (data analysis) I’m already proficient in.

I committed to improving my data analysis skills a while ago, and writing about it got tedious. But now, I need to learn Python for work. So what better way to cement my learning than to teach others through a blog series?

The Python Blog Series

This Python blog series will be useful for beginners like me—people who want a structured, easy-to-follow guide with clear examples and useful explanations.

By the end of it, you should be able to write basic Python code. If not, just search for the 100s of videos on YouTube on the topic.

The plan is to post a new/short lesson at least once a week (let’s see how that goes).

What Will We Cover?

Each post will focus on a specific topic – likely something I am working through at a specific point in time.

  • Python basics (variables, data types, functions)
  • Working with Pandas to analyze data
  • Cleaning and filtering datasets
  • Summarizing data with statistics
  • Plotting graphs and visualizing trends
  • Performing regressions and predictive modeling

We will take it step by step. Each post will focus on one concept at a time. The goal is to provide clear and simple explanations!

I work best will realistic data so I created a fictional dataset we can use. We will get into it later.

Who Is This Series For?

If you’ve never coded before, or if you’ve used another programming language but want to switch to Python, this will be a great series for you.

In the next post, we’ll learn more about Python and try to understand why this programming language might be helpful.

Recommended Python Books

Which is easier to learn: Python or R?

As many of you know, I am committed to learning and writing in public. That means writing about what I learn, showcasing the tools and resources I use, and showing my work or unfinished products.

My current goal is to learn Python or R. While I am familiar with both, I need to start from scratch to advance my skills. Ideally, I would like to start with the easier language (based on my current skill level and knowledge of other programming tools). But is Python easier to learn than R, or is R the easier language?

Some caveats

I am interested in data analyses, graphics/visualization, and general programming. While I figured that there are some things Python may do better than R or vis versa, I am interested in using the more robust tool.

I am also well versed in Stata and I’m satisfied with my knowledge of the app, but I find that I’m limited by not knowing one of the widely recognized programming languages. I am also aware that Stata has PyStata, a new Python and Stata integration that allows users to use Stata from a Python environment. This feature is an added plus for me to pursue learning Python.

Two important notes

  • One is not necessarily better than the other. I am only trying to decide which tool best fits my needs.

What is Python?

Python is a general programming language that serves multiple purposes. Python is used for web and software development, scripting, and data analysis. Users can access different packages developed by other Python users, including SciKit-learn, SciPy, and NumPy.

Some users suggest that Python is a more general tool than R.

What is R?

R is a language and environment for statistical computing. R has a library of open-source software that makes it a rich program, including tidyverse, dplyr, and tidyr. It is primarily used for statistical analysis. R would be sufficient if I were only interested in data analyses and modeling (e.g., linear and nonlinear regression).

So far, I’ve learned three important things about R:

  • R Syntax is not as readable as Python
  • It is not necessarily a programming language
  • It is mainly for statistics, though the program allows for other possibilities

Python or R?

Both Python and R are free, open-source programming languages. Both have supportive communities that contribute to different packages. Visualization in R is generally better than Python for some users of both applications. I’m familiar with ggplot2 because I’ve come across many excellent R visualizations that have used the package to produce high-quality graphics.

Overall, learning Python is more accessible and friendly for people just getting started with coding. The general advice is to learn Python if you are new to coding; learn R if you are focused mainly on statistics or data analyses.

I was told to decide whether to learn Python or R based on my goals. Since I am not only focused on data analyses, I’ll stick with learning Python and look to strengthen my R skills down the line. Python and R can also communicate with each other, so may look into setting this up once I become proficient with both.

You may be interested in these posts…


You may support me with a generous cup of coffee.