Code Challenge 51 – Analyse NBA Data with SQL/sqlite3

By on 17 September 2018

It’s not that I’m so smart, it’s just that I stay with problems longer. – A. Einstein

Hey Pythonistas,

Blog Code Challenges is back! And with a vengeance 😉

Starting today we will publish a new code challenge every week on Monday. On Friday (or latest the weekend) we will post a review.

Welcome to Pybites Code Challenge 51! In this challenge we get you analysing NBA player data from a CSV file.

The Challenge

If you are reading this on our blog head over to https://codechalleng.es/challenges/51.

If you need help getting ready with Github, see our new instruction video.

Now for the challenge:

  • Make a virtual env and install requests. No need to install sqlite3 as it’s part of the stdlib.

  • Copy the nba.py file over to your subdirectory.

  • As you can see in the template nba.py file, we’ve given you a headstart by importing the data and parsing the CSV into a list of named tuples.

  • Start coding under the “#CODE HERE” comment and complete the 7 functions we’ve laid out for you.

  • Note that there are some assert statements under main to help you validate your code.

  • This challenge is mainly focused on sqlite3, but if you want to use an ORM like sqlalchemy or Pandas that’s fine too.



PyBites Community

A few more things before we take off:

  • Do you want to discuss this challenge and share your Pythonic journey with other passionate Pythonistas? Confirm your email on our platform then request access to our Slack via settings.

  • PyBites is here to challenge you because becoming a better Pythonista requires practice, a lot of it. For any feedback, issues or ideas use GH Issues, tweet us or ping us on our Slack.


>>> from pybites import Bob, Julian

Keep Calm and Code in Python!

Want a career as a Python Developer but not sure where to start?