This post originally appeared on my personal website. You can view an updated version with code formatting on my blog.
At my job, I do a lot of data analysis to find the most promising young startups. As a first step, you always have to import the desired data into a Pandas DataFrame and do some preprocessing, for example by importing JSON data from some API.
When importing JSON data, you usually have a lot of temporary columns in your DataFrame which can get messy quickly. To deal with temporary columns, I built a custom Context Manager that keeps track…