Appendix A — Setting up Python and an introduction
[Python] is a popular and beginner-friendly programming language known for its simplicity and readability. It’s widely used in web development, data science, automation, artificial intelligence, and more. Whether you’re analyzing data, building a website, or creating software, Python is a powerful and versatile tool to learn.
A.1 Laptop setup
If you prefer to have [Python] installed on your laptop, then do the following:
- Go to the official Python website: https://www.python.org/downloads
- Click the download button for your operating system (Windows, macOS, or Linux).
- Run the installer.
- Important: Make sure to check the box that says “Add Python to PATH” during installation.
- Follow the prompts to complete the installation.
To verify the installation, open a terminal or command prompt and type:
python --version
To install an IDE for working with your code, you may install Visual Studio Code (VSCode):
Go to the VSCode website: https://code.visualstudio.com
Download and install the version for your operating system.
Open VSCode after installation.
Install the Python extension in VSCode:
- Go to the Extensions tab (or press
Ctrl+Shift+X
) - Search for “Python” and install the one published by Microsoft
- Go to the Extensions tab (or press
You’re now ready to start coding in Python!
A.2 Learning Python
If you are new to Python you may have a look at some [DataCamp] Courses. First you HAVE TO SIGNUP using [this link][datacamp-signup]. Afterwards have a look at these courses:
Introduction to Python - Learn the basics of Python programming, including variables, data types, and control flow.
Intermediate Python - Build on your basic knowledge with functions, loops, and working with Python libraries.
Data Manipulation with pandas - pandas is the world’s most popular Python library, used for everything from data manipulation to data analysis.
A.3 R and Python packages
If you are used to do data transformation in R then this table may be useful.
R Package | Purpose | Python Equivalent(s) | Notes |
---|---|---|---|
dplyr |
Data manipulation (filter, mutate, etc.) | pandas , dfply , siuba |
pandas is standard; dfply and siuba mimic dplyr syntax with pipes and tidy verbs |
ggplot2 |
Data visualization (Grammar of Graphics) | plotnine |
Closest match in syntax and philosophy; uses + for layers like ggplot2 |
tidyr |
Data tidying (pivoting, reshaping) | pandas , pyjanitor |
pandas handles pivot , melt ; pyjanitor adds more tidy-like helpers |
readr |
Read/write CSV | pandas |
Use read_csv() , to_csv() |
jsonlite |
Read/write JSON | json (standard), pandas |
json for raw files; pandas.read_json() for tabular JSON |
readxl / writexl |
Read/write Excel | pandas , openpyxl , xlsxwriter |
pandas integrates with Excel libraries for reading/writing .xlsx |
googlesheets4 |
Google Sheets I/O | gspread , gspread-pandas |
Python requires Google API setup; gspread-pandas integrates with DataFrames |