No description or website provided.
Python Shell

README.md

MeanBabyNames

This is a challenge I did for a job I applied for. The task was to construct a script which accepts a name and range of years as parameters and returns the arithmetic mean of the rank of male children within the top 1,000 results for that date range.

The script needed to use web scraping to retrieve the names, and cache the details locally so it would work even if the website went offline.

How to run

The easiest way to run this is to use vagrant: https://www.vagrantup.com/

  1. Clone the git repository
  2. Run vagrant up to start the Vagrant box
  3. Type vagrant ssh
  4. In the vagrant ssh window, type cd /vagrant
  5. Type python baby_names.py <name> <start_year> <end_year> for example python baby_names.py Billy 1992 2001

If you want to run directly on linux:

  1. Clone the repo
  2. Run pip install -r requirements.txt to install the pip requirements (lxml)
  3. Type python baby_names.py <name> <start_year> <end_year> for example python baby_names.py Billy 1992 2001

Caching

Once you run a command once the results will be cached in a sqlite database for offline mode and faster access in the future.