Skip to content

Instantly share code, notes, and snippets.

@javitonino
Forked from javisantana/python_code_test_carto.md
Last active April 4, 2019 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javitonino/667321178a9b246ad1ac95074cc40f1c to your computer and use it in GitHub Desktop.
Save javitonino/667321178a9b246ad1ac95074cc40f1c to your computer and use it in GitHub Desktop.
Python code test - CARTO

Build the following and make it run as fast as you possibly can using Python 3 (vanilla). The faster it runs, the more you will impress us!

Your program should:

  1. Download this 2.2GB file: https://s3.amazonaws.com/carto-1000x/data/yellow_tripdata_2016-01.csv (keep in mind, the file could get much bigger in the future)
  2. Count the lines in the file
  3. Calculate the average value of the tip_amount field.

All of that in the most efficient way you can come up with.

So, we'd do:

$ time python script.py https://s3.amazonaws.com/carto-1000x/data/yellow_tripdata_2016-01.csv
AVG_VALUE
x.00s user x.00s system 81% cpu x.000 total

That's it. Make it fly! Oh, and please do tell us why you did it that way! A quick reasoning about your decisions is always appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment