Code Challenge 13 - Highest Rated Movie Directors - Review

PyBites, Sat 08 April 2017, Challenges

codechallenges, data analysis, defaultdict, imdb, learning, movies, namedtuples, sort

It's end of the week again so we review the code challenge of this week: Highest Rated Movie Directors. It's never late to join, just fork us and start coding.

Our solution and learning

You can find our solution here. Some highlights:

TODOs

We realized during the challenge that you could also solve this with SQL or Pandas. We will update the solutions branch when we get around this. It would be nice to give it a try. Of course if you took these (or other) approaches feel free to share your solution opening a PR against our community branch.

Community

Here is another solution by atakume we merged in our community branch. What we like about this solution is the use of itertools.groupby, doing the sorting outside the print_results function, and the second namedtuple which adds readability:

Filmography = namedtuple('Filmography', 'director movies avg_score')

Stay tuned

Next week we will let you play with decorators, a great feature for writing DRY, reusable code. It will be fun :)

We hope you are enjoying these challenges, learning along the way. Let us know if you have any issue and/or contact us if you want to submit a cool challenge. See you next week ...