2021: Week 10 - Pokémon Hierarchies

Challenge By: Jenny Martin

I can hear the hesitancy already surrounding this challenge. "I know nothing about Pokémon, how can I participate?" Well, rest assured, you don't need to understand the data in order to work with it and complete this challenge. In fact, I believe this challenge could help with most hierarchical data. 

The aim of this challenge is to group Pokémon into Evolution Groups. Why? So that when we select any Pokémon, we can see all the information about what they evolved from, what they will evolve to etc. In the example below, Bulbasaur evolves into Ivysaur, who then evolves into Venusaur. Choose another Pokémon like Flareon and we can see it evolves from Eevee, who has multiple evolution possibilities.


How is this applicable to other hierarchical data? Well imagine that a Pokémon that has a null in the Evolves From field is similar to an employee at Work Level 1 in an organisation. Their manager would then sit in the Evolves To field. Our Evolution Group in this instance would be the Team the employee belongs to and it would give us the ability to type in any employee name and return information about which team they belong to and the structure of that team. 

Sure, I could have chosen to design this challenge to be working with employees, but I believe it's useful to work with data outside of your comfort zone every now and then to prove to yourself that your prep skills are applicable no matter what the dataset. Plus it's just more fun to work with Pokémon!

Input

We have 2 inputs this week:
  1. Pokémon
  2. Evolution

Requirements

  • Input the data
  • Our Pokémon dataset actually contains too many Pokémon: (help)
    • We're only interested in Pokémon up to Generation III, which is up to (and including) number 386
    • This means we're also not interested in mega evolutions so we can filter Pokémon whose name start with "Mega"
  • Some Pokémon have more than one Type. We aren't interested in Types for this challenge so remove this field and ensure we have one row per Pokémon (help)
  • Now we want to bring in information about what our Pokémon evolve to (help)
    • Warning!  In our Evolution dataset, we still have Pokémon beyond Gen III. You'll need to filter these out too, from both the evolved from and evolved to fields (help)
  • Bring in information about what a Pokémon evolves from (help)
    • Ensure that we have all 386 of our Pokémon, with nulls if they don't have a pre-evolved form or if they don't evolve
  • Finally, for Pokémon that have 3 evolutions, we want to know what the First Evolution is in their Evolution Group (help)
  • Some duplication may have occurred with all our joins, ensure no 2 rows are exactly the same (help)
  • Create a calculation for our Evolution Group (help)
    • The Evolution Group will be named after the First Evolution e.g. in the above example, Bulbasaur is the name of the Evolution Group
  • Output the data

Output

  • 15 fields
    • Evolution Group
    • #
    • Name
    • Total
    • HP
    • Attack
    • Defense
    • Special Attack
    • Special Defense
    • Speed
    • Evolving from
    • Evolving to
    • Level
    • Condition
    • Evolution Type
  • 397 rows (398 including headers)

The full output can be downloaded here.

After you finish the challenge make sure to fill in the participation tracker, then share your solution on Twitter using #PreppinData and tagging @Datajedininja@JennyMartinDS14 & @TomProwse1

You can also post your solution on the Tableau Forum where we have a Preppin' Data community page. Post your solutions and ask questions if you need any help! 

Popular posts from this blog

2023: Week 1 The Data Source Bank

2023: Week 2 - International Bank Account Numbers

How to...Handle Free Text