Data Analysis of the MechanicalKeyboards Subreddit

I have been using classic buckling spring IBM Model M computer keyboards since I first began programming. These are great to type on and I still love them (kind of feels like typing on a typewriter), but I decided recently that I should upgrade to a compact keyboard that uses modern mechanical switches. There seems to be an endless sea of options to choose from though; the first step in my consumer journey is to narrow my options down to a few top brands, so what is an aspiring data scientist to do? I thought a good way to cut through the clutter would be to scrape the r/MechanicalKeyboards subreddit to see what brands are the most talked about currently. So I wrote this Python script that uses Reddit’s API to scrape the subreddit.

import praw
from praw.models import MoreComments
import datetime
import pandas as pd

# Lets use PRAW (a Python wrapper for the Reddit API)
reddit = praw.Reddit(client_id='', client_secret='', user_agent='')

# Scraping the posts
posts = reddit.subreddit('MechanicalKeyboards').hot(limit=None) # Sorted by hottest
posts_dict = {"Title": [], "Post Text": [], "Date":[],
               "Score": [], "ID": [],
              "Total Comments": [], "Post URL": []

comments_dict = {"Title": [], "Comment": [], "Date":[],
              "Score": [], "ID": [], "Post URL": []

for post in posts:
    # Title of each post
    # Text inside a post
    posts_dict["Post Text"].append(post.selftext)
    # Date of each post
    dt = # Convert UTC to DateTime
    # The score of a post
    # Unique ID of each post
    # Total number of comments inside the post
    posts_dict["Total Comments"].append(post.num_comments)
    # URL of each post
    posts_dict["Post URL"].append(post.url)
    # Now we need to scrape the comments on the posts
    id =
    submission = reddit.submission(id)
    submission.comments.replace_more(limit=0) # Use replace_more to remove all MoreComments
    # Use .list() method to also get the comments of the comments
    for comment in submission.comments.list(): 
        # Title of each post
        # The comment
        # Date of each comment
        dt = # Convert UTC to DateTime
        # The score of a comment
        # Unique ID of each post
        # URL of each post
        comments_dict["Post URL"].append(post.url)

# Saving the data in pandas dataframes
allPosts = pd.DataFrame(posts_dict)

allComments = pd.DataFrame(comments_dict)

# Time to output everything to csv files
allPosts.to_csv("MechanicalKeyboards_Posts.csv", index=True)
allComments.to_csv("MechanicalKeyboards_Comments.csv", index=True)

Reddit limits API requests to 1000 posts, so the most current 1000 posts is my sample size. My code outputs two files: the last 1000 posts, and more importantly the comments on those 1000 posts, which ended up being 9042 rows of data. (I posted the files to Kaggle if anyone would like to play with them.) Then I imported my comments dataset into OpenRefine so I could run text filters to find brand names, and I recorded the number of mentions for each brand. Finally, using Tableau, I created a couple of Data Visualization charts to express my findings. Here are the most talked about keyboard brands on r/MechanicalKeyboards currently:

Loader Loading…
EAD Logo Taking too long?

Reload Reload document
| Open Open in new tab
Loader Loading…
EAD Logo Taking too long?

Reload Reload document
| Open Open in new tab

Hokusai Reimagined

For a class project, I decided to reimagine Katsushika Hokusai’s seminal “Red Fuji” as ASCII art. Essentially, I wrote a Python script that converted Hokusai’s “Red Fuji” into text art using only the letters in Hokusai’s name. Since different letters have different visual weights, you can use them for gradations of shading. The script converts the image into black and white, then assigns a numerical value to each pixel depending on how dark the shading is. Then it replaces each pixel with the letter assigned to that shade range. I like how it turned out.

R.O.B. Robot Hack

This was a fun electronics project that I did a few years ago. I hacked an old Nintendo NES R.O.B Robot to be controllable from a PC via a webpage (I ended up selling the robot to someone who wanted to use it in a commercial).

I used a Teensy micro-controller soldered to the robot’s original circuit board and a bit of code to interpret serial input. Then I made a PHP file that sends serial data to the Teensy’s port and made an gui with a bit of Bootstrap. Here is the code if you’d like to try this yourself: R.O.B. Robot Controller