TLDR; Using pandas (pip install pandas) Using native csv.DictReader Reading as a List Let’s say we have the following CSV file, named actors.csv. You can download this file here. The first method demonstrated in Python docs would read the file as follows: Open the file Create a CSV reader Skip first line (header) For every line (row) in […]
Archives for December 2017
Convert JSON to dot notation with Python
There are many use cases for converting JSON to a dot notation. For example, my current company used Hue to query our log data. Our logs are stored in JSON, and Hue queries expect a dot notation. For example, this JSON file Will look like this, when converted to dot notation: Note, I am starting […]
Writing Bad Code is Depressing
Recently I was working on a fun idea, that was going to take me longer than one week to complete. Towards the second week I found myself dreading going back to work on my “fun” project. I wasn’t sure why… Was I no longer excited about the idea? Was I just too tired? Was I […]
Bitcoin Energy Waste in 2017 is Estimated to Equal 1.5 Million Cars
Bitcoin Energy Consumption Index is an attempt to estimates total energy cost of mining Bitcoin. Their methodology is based on the fact that energy needed to mine Bitcoin will increase in response to oversupply of mining resources. To quote the Bitcoin Wikipedia article: Every 2,016 blocks (approximately 14 days at roughly 10 min per block), […]
Parsing “Ask HN: Who is hiring?” with Python and Hacker News API
Have you heard of Hacker News? It’s a great mini social network dedicated to all things tech. Once a month they post a thread called “Ask HN: Who is hiring?”, where anyone can list their job openings. With hundreds of comments it quickly gets overwhelming. Turns out it’s very easy to get the same data […]