Assignment 4: Pandas
Authors: Michael Hewitt, Stefan Aschauer, Bernhard Steiner
Purpose
The purpose of this assignment is to provide you with more practice using the pandas library as well as matplotlib.
Therefore you should use the provided pokemon dataset and do various computations on the data.
Provided Starting Materials
Start with these files:
Assignment
Your task is to take a provided file containing all of the pokemon from generations 1-6 ans implement the following funtions to analyze the data.
Complete the functions within the provided python file.
- Step 1 - calculateTotalCombatPower():
Calculate the total combat power for each pokemon and add it to the dataset. The total CP calculates as the sum of all combat stats (hp, attack, defense, etc.)
- Step 2 - printCSV(data, filename):
Write the data to the specified file as csv.
- Step 3 - topNPokemon(data, n):
Find the strongest n Pokemon and print them in a bar graph. Give each bar a color fitting the type of the pokemon
- Step 4 - topNNoMegaPokemon(data, n):
Find the strongest n non-mega Pokemon and print them in a bar graph. Removing all Mega-Forms can be achieved by removing all Pokemon with duplicate numbers.
- Step 5 - averagePowerPerGeneration(data):
Calculate the average powerlevel of Pokemon from each Generation, and print it to the commandline
- Step 6 - pokemonPerGeneration(data):
Show the number of Pokemon per Generation in a pie chart
- Step 6 - buildTeam(data):
Try to implent an algorithm that finds the most efficient Team possible. A Team consists of six Pokemon.
An efficient Team covers a wide range of different Types while having as much combat power as possible. Try considering both the
primary and the secondary Type of a pokemon, if i has one.
To make your team more realisticically achievable, try using only non-legendary pokemon
- Step 7 (Bonus) - buildTeamBonus(data):
This function should work in a similar way as buildTeam. Instead of trying to cover a wide array of types, you should build your team in a way
that your pokemon have effective types against a wide array of enemy types. Hint: Each type has one or more types that it is weak to (e.g. fire is weak against
The following images show how your solution could look like:
Grading - 100 points possible
- 15 points: Calculate the total combat power and save it to a .csv file
- 45 points: 15 for each chart (Step 3, 4, and 6)
- 15 points: Calculate the average combat power of each Generation and print it
- 20 points: Implement the function to build an efficient team
- 5 points: Proper commenting
- 10 bonus points: Implement the bonus function, to build even more efficient teams