8 Ways to Create (Initialize) Pandas Data Frames
| | |

8 Ways to Create (Initialize) Pandas Data Frames

One of the key tasks for data scientists and computer programmers is to read, write, organize, and manipulate data. Perhaps the most intuitive format in which these data are stored is the tabular format. This format organizes data into tables, which are also commonly referred to as data frames or spreadsheets. Because of data, programs…

Vectorize Moving Window Grid Operations on NumPy Arrays
| |

Vectorize Moving Window Grid Operations on NumPy Arrays

There’s a good chance you’ve done something today that used a sliding window (also known as a moving window) and you didn’t even know it. Have you done any photo editing? Many editing algorithms are based on moving windows. Do you do terrain analysis in GIS? Most topographic raster metrics (slope, aspect, hillshade, etc.) are…

Zonal Statistics Algorithm with Python in 4 Steps
| | |

Zonal Statistics Algorithm with Python in 4 Steps

It is a common need to summarize information from a gridded dataset within an irregularly shaped area. While at first glance this may seem simple, reconciling differences between raster (gridded) and vector (polygon) datatypes can quickly become complicated. This article shows how to implement a zonal statistics algorithm in Python in 4 steps. Load raster…

Parallel Programming in Python with Message Passing Interface (mpi4py)
| | | |

Parallel Programming in Python with Message Passing Interface (mpi4py)

Did you know you can write parallel Python code that will run on your laptop and on a super computer? You can, and it’s not as difficult as you might expect. If you already write code for asynchronous parallelization then you won’t even have to do much restructuring. High Performance Computing (HPC) distributes pieces of jobs across…

Asynchronous Parallel Programming in Python with Multiprocessing
| |

Asynchronous Parallel Programming in Python with Multiprocessing

A flexible method to speed up code on a personal computer Do you wish your Python scripts could run faster? Maybe they can. And you won’t (probably) have to buy a new computer, or use a super computer. Most modern computers contain multiple processing cores but, by default, python scripts only use a single core….