Spatial Analysis with R and Python

Material for Labs - Spatial Econometrics Advanced Institute 2022

Python Setup

If you are not an expert user of Python, I recommend you to use Colab.

Google Colab

Google makes available its free tool Colab which mackes possible to run Python Notebooks on the cloud.
Colab notebooks enable you to combine executable code and rich text in a single document, as well as images, HTML, LaTeX, and other formats. Click here to be immediately redirected to Colab. Colab allows to avoid some installation issues that might happen in using Jupyter on your computer, for example administrator permissions limitations (in a company/university lab laptop). For this reasons, Colab is the deafult choice for this course.

Quick Overview

Colaboratory, or “Colab” for short, allows you to write and execute Python in your browser, with

  • Zero configuration required
  • Free access to GPUs
  • Easy sharing

Whether you’re a student, a data scientist or an AI researcher, Colab can make your work easier. - Google Colab

Take a look at this YT Colab quickstart to get famniliar with Colab.


Jupyter Notebook

The Jupyter Notebook is a web-based application for document authoring that combines live codes with narrative text, equations and views.

In order to install Jupyter Notebook on your computer follow step-by-step the documentation linked here.

How to install

The fastest and easiest way to start with Python is with Anaconda. Anaconda conveniently installs Python, the Jupyter Notebook, and other commonly used packages for scientific computing and data science. Moreover it allows scientist and analys to concentrate on data instead of environments and package management.

For experienced Python users

Jupyter installation requires Python 3.3 or greater, or Python 2.7. IPython 1.x, which included the parts that later became Jupyter, was the last version to support > Python 3.2 and 2.6.

If you are already a Python user, you may prefer to install Jupyter via Python’s package manager, pip, rather than Anaconda.

First, make sure you have the most recent pip; older versions may have problems with some dependencies:

pip3 install --upgrade pip

Then, install the Jupyter Notebook by following this step:

pip3 install jupyter

You have Jupyter Notebook installed on your computer.
At this point you can become familiar with Jupyter Notebooks through this resource