Solve TypeError: ‘dict’ object does not support indexing when running SQL queries in Python

  • by
  • 2 min read

I ran into another silly error, for which I wanted to share the solution in order to save you some time. It occurs when trying to run a query using Python’s SQLAlchemy libary. Let’s dive right in. The problem When you’re trying to run a query, either by using Pandas’… 

How to copy the first value of a group to all rows in the group of a Pandas DataFrame

  • by
  • 2 min read

Recently, I needed to calculate the relative change of a value compared to the first value within a DataFrame group, a GroupBy object. With SQL, I would use a window function (e.g. PARTITION BY in PostgreSQL). In this article, we’ll do it in Pandas (Python). To demonstrate, let’s start with… 

Python: execute shell commands (and get the output) with the os package

Running shell (e.g. Bash) commands in Python is fairly easy using the os package. In this article, I outline two ways to run shell commands in Python: using the system method and the popen method. This article is part of a two-part series related to running shell commands from within… 

Fix “End user credentials must match the user specified in the request.” in GCP

In this article, we’ll discuss an error I ran into when trying to create SSH keys for a service account in Google Cloud Platform (GCP). Nevertheless, I assume it’s something that can happen in many situations where you’re trying to perform an operation as a service account. I hope to… 

Fix “Source url of disk is missing” when attaching disk to instance in GCP using Python

  • by
  • 2 min read

I would like to briefly elaborate on an error I ran into, which is due to limited documentation on the Google Cloud Platform API. With this article, I hope to save you the time and effort to find the solution. I’ve been following an infrastructure-as-code approach to deploying GCP resources…