2020: Week 3

NBA Results to NBA Standings

This week’s challenge is a simple concept that’s tricky to execute: we want to take the current results from the 2019/20 NBA season (as of Jan 6th, 2020 at 11:00AM GMT+0) and produce two league tables: one for the Eastern Conference and one for the Western Conference.

We’ve sourced the game results in CSV format from www.basketball-reference.com and the exact league tables we’re recreating are the ones provided by Google.

The link above displays the current standings, however we’re aiming to recreate the ones seen below as they represent the standings at 11:00AM GMT+0 on Jan 6th, 2020.

Eastern Conference Standings
Western Conference Standings
















Input

There is one input with 5 sheets:
  • Team List
  • October
  • November
  • December
  • January
"Team List" contains the details of the conference and division for each team, whilst the other sheets contain the results of all the games so far. January's sheet has some empty results as those games have not yet been played.

Requirements

For each team we're looking to discover the following information:
  1. Rank: Rank for each team within their conference.
  2. W: Wins for each team.
  3. L: Losses for each team.
  4. Pct: Win percentage for each team.
  5. Conf: The wins and losses for each team against teams within the same conference only.
  6. Home: The wins and losses for home games for each team.
  7. Away: The wins and losses for away games for each team.
  8. L10: The wins and losses for the last (most recently played) 10 games for each team.
  9. Strk: The current winning or losing streak that each team is on.
The only column not required for this challenge is the GB (games behind).
After producing these pieces of information, split the teams into two separate outputs - one for each conference.

Output

There should be two outputs - one for each conference - that meet the following criteria.
  • 15 rows.
  • 10 fields:
    • Rank
    • Team
    • W
    • L
    • Pct
    • Conf
    • Home
    • Away
    • L10
    • Strk
  • The output should match the screenshots shown above.
You can also see our output here. You can also update the input file with the latest NBA results using the links above to produce the up-to-date standings if you want! Don’t forget to fill the participation tracker and share your solutions using #PreppinData on Twitter.

Advice

If you're struggling then focus on figuring out one new field at a time - you can always join them all together at the end!

Popular posts from this blog

2023: Week 1 The Data Source Bank

2023: Week 2 - International Bank Account Numbers

How to...Handle Free Text