Skip to content
Home » python » Page 2

python

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

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… 

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…