Jupyter Notebooks

Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

JupyterLab is the next-generation user interface for Project Jupyter. It offers all the familiar building blocks of the classic Jupyter Notebook (notebook, terminal, text editor, file browser, rich outputs, etc.) in a flexible and powerful user interface.

Setup Jupyter Notebook

Install Jupyter Notebook with the following command. Alternatively, it is already packaged and ready to use with the Anaconda distribution.

pip install jupyter

Starting the Notebook Server:

jupyter notebook

Open a specific Notebook:

jupyter notebook notebook.ipynb

Setup JupyterLab

Install JupyterLab with the following command.

pip install jupyterlab

Launch by running:

jupyter lab

Useful IPython commands

The %matplotlib inline command is an IPython magic function that sets the output …

Continue reading »


React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It lets you compose complex UIs from small and isolated pieces of code called “components”.


Best way to set up React is via NodeJS package manager npm. Go to nodejs.org and download NodeJS (LTS version is recommended). It is also recommended to install React Developer Tools

To start a project we use the create-react-app tool. By using npx we run the create-react-app script without installing. Using npm will install the create-react-app package globally.

mkdir my-app
npx create-react-app .
npm start

This creates the following project structure:

my-app ├── README.md ├── node_modules ├── package.json <-- app info and dependencies ├── .gitignore ├── public │ ├── favicon.ico │ ├── index.html <-- main webpage where React is outputed │ └── manifest.json └── src ├── App.css ├── App.js <-- App component ├── App.test.js ├── index.css ├── index.js <-- React entry point ├── logo.svg └── serviceWorker.js

Continue reading »

Create a REST API with Django Rest Framework


Continue reading »


Add a folder to the Anaconda path

By adding a folder to the Anaconda path you can call its Python scripts from any location in the Anaconda Prompt.

cd your_folder
conda-develop .


conda-develop /path/to/module/


Continue reading »

Visual Studio Code setup


General use extensions

Python extensions

  • Python - Linting, Debugging, Intellisense, formatting, etc

LaTeX extensions

  • LaTeX Workshop - LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more
  • LaTeX Utilities - Add-on to LaTeX Workshop that provides some extra, non-essential, features.


  • Live Server - Launch a development local Server with live reload feature for static & dynamic pages
  • Debugger for Chrome - Debug your JavaScript code in the Chrome browser
  • Prettier - Code formatter


Continue reading »

VSCode shortcuts for Windows


Open Command Pallete


Access Settings


Toggle Terminal


Create New Terminal


Toggle Sidebar


Open New Window/Instance


Close Window


Working With Files

Sidebar Focus


Open File/Folder From Sidebar


Change File Tabs


Quick File Open


Open File From Explorer


New File




Save As


Close File


Delete File


Reopen Files



Ctrl++ # Zoom in
Ctrl+- # Zoom out

Spilt Editor


Code Editing

Go To Start & End Of Line



Move By Word


Go To Start & End Of File


Cut, Copy & Past Line

Ctrl+X # Cut
Ctrl+C # Copy
Ctrl+V # Paste

Move Line Up & Down

Alt+Up …

Continue reading »

Geo ploting with Basemap

The matplotlib basemap toolkit is a library for plotting 2D data on maps in Python.


Option 1:

The recommended installation method for Basemap is using Anaconda and the conda-forge channel. In the Anaconda Prompt run:

$ conda install -c anaconda basemap

You might also need to run the following command to install PROJ, which is a required dependency of Basemap:

$ conda install -c conda-forge proj

If the installation was sucessful you should now be able to run the following import in the Python (Anaconda) prompt without any errors:

from mpl_toolkits.basemap import Basemap

Option 2:

If you are on Windows you can also install the binaries directly. This worked better for me than installing through Anaconda and conda-forge. Download the Basemap and PROJ binaries. Make sure you download the correct binary for your Python version. For instance, if you have Python 3.7 64-bit make sure to download the pyproj …

Continue reading »

Data Visualization

Plotting libraries

  • Matplotlib: Python de facto 2D plotting library.

  • seaborn: Based on matplotlib, it provides a high-level interface for drawing attractive and informative statistical graphics.

  • Altair: A declarative statistical visualization library for Python, based on Vega and Vega-Lite

Web ready

  • Bokeh : Creates interactive, web-ready plots, which can be easily output as JSON objects, HTML documents, or interactive web applications.

  • Plotly: Makes interactive plots, but it offers some charts you won’t find in most libraries, like contour plots, dendograms, and 3D charts.


  • Folium: Folium makes it easy to visualize data that’s been manipulated in Python on an interactive leaflet.js map.

  • Basemap: A matplotlib toolkit library for plotting 2D data on maps in Python.

Continue reading »

Graphical user interface in Python

For simple command line programs

  • Gooey - Turn (almost) any Python command line program into a full GUI application

GUI libraries

  • TkInter - Python’s de-facto standard GUI available in the standard library

  • PySimpleGUI - Transforms tkinter, Qt, Remi, WxPython into portable people-friendly Pythonic interfaces

  • Kivy - Cross-platform GUI library supporting both desktop operating systems (Windows, macOS, Linux) and mobile devices (Android, iOS).

  • PyQt5, QtPy, PySide - There are Python bindings available for the Qt toolkit (using either PyQt or PySide). PyQt is currently more mature than PySide, but you must buy a PyQt license if you want to write proprietary applications. PySide is free for all applications.


  • Streamlit - Makes it easy to build beautiful apps for machine learning.

Continue reading »

Argument parsing using the argparse module

argparse is a Python Standard Library module to write user-friendly command-line interfaces. The program defines what arguments it requires, and argparse will figure out how to parse those out of sys.argv. The argparse module also automatically generates help and usage messages and issues errors when users give the program invalid arguments


import argparse

# Instantiate the parser
parser = argparse.ArgumentParser(prog='Optional app name', 
                                 description='Optional app description', 
                                 epilog='Enjoy the program!')

By default, the argparse uses the value of the sys.argv[0] element to set the name of the program (name of the Python script). However, you can specify the name of your program just by using the prog keyword.

You can customize the text displayed before and after the arguments help text using the description and epilog keywords.

Add Arguments

# Required positional argument
parser.add_argument('pos_arg', type=int,
                    help='A required integer positional argument')

# Optional positional …

Continue reading »