In this homework you will practice
This is an individual assignment.
Collaboration at a reasonable level will not result in substantially similar code. Students may only collaborate with fellow students currently taking this course, the TAs and the lecturer. Collaboration means talking through problems, assisting with debugging, explaining a concept, etc. You should not exchange code or write code for others.
Notes:
You are a Pokemon Trainer in the Sinnoh region who’s hit a slump, and you realize that, in order to get out of it, you need a better understanding of the Pokemon around you. So, you head to the Pokemon School in Jubilife City, and learn that Pokemon Battles are very reliant on various different statistics that you previously had no idea about. So, you decide to use Pandas to familiarize yourself with all of these new numbers and determine what you need to do to become a better pokemon trainer.
You are given a csv file, SinnohPokemonStats.csv, that includes a Pokemon’s Pokedex Number and all of its stats:
In a Jupyter Notebook titled pokemon-analysis
complete the following tasks.
Create a DataFrame from the csv file called df
and set the index column to the Pokemon’s Pokedex Number
Create a column in df
called Comb. Attack
that includes the sum of the Pokemon’s Attack and Special Attack Stats and a column called Comb. Defense
that includes the sum of the Pokemon’s Defense and Special Defense Stats. There is a 2-line maximum to complete this task (+10)
Create a column called Class
that has the value “Attacking” if the Pokemon’s Attack is greater than its Defense or if its Special Attack is greater than its Special Defense, and “Defensive” otherwise. There is a 1-line maximum to complete this task (+10)
Assign a DataFrame called summary
to a DataFrame that includes the count, mean, standard deviation, min, 25th percentile, 50th percentile, 75th percentile, and max of each numerical column. There is a 1-line maximum to complete this task (+10)
Assign the variable type_col
to a series of all the column types in this DataFrame. There is a 1-line maximum to complete this task (+10)
Assign the variable one_type
to an integer that represents the count of pokemon without secondary types. There is a 1-line maximum to complete this task (+10)
Assign the variable avg_speed
to an integer that represents the average speed for Pokemon with pokedex numbers between 40 and 60, There is a 1-line maximum to complete this task (+10)
Assign the variable type_speeds
to a Series that corresponds to the average speed for each primary type there is a 1-line maximum to complete this task (+10)
Assign the variable type_counts
to Series that corresponds to the count of each pokemon with each primary type. There is a 1-line maximum to complete this task (+10)
Assign the variable strongest_steel
to a Series that corresponds to the Primary Steel Type Pokemon with the highest attack stat. There is a 1-line maximum to complete this task (+10)
Assign the variable strongest_by_type
to a DataFrame that corresponds to the Pokemon with the Highest Total Stat count for each Primary Type. There is a 1-line maximum to complete this task (+10)
Bonus: Cynthia is the Strongest Trainer in the Sinnoh Region and in order to defeat her you need to optimize your team of 6 pokemon i.e all your 6 pokemon need to have the maximum value for each desired stat and be of the optimal type.
Her Spiritomb is weak to Fast Fairy Type Pokemon
Her Roserade is weak to Attacking Psychic Type Pokemon
Her Togekiss is weak to Defensive Rock Type Pokemon
Her Lucario is weak to Special Attacking Ground Type Pokemon
Her Milotic is weak to Attacking Grass Type Pokemon
Her Garchomp is weak to Special Defensive Ice Type Pokemon
Create a DataFrame called optimal_team
that includes the 6 Pokemon that best meet the specifications above. (+20)
Each Task is worth 10 points The Bonus is worth 20 points Make sure that your variable names match the directions, otherwise we won’t be able to properly grade your assignment
Attach your pokemon-analysis.ipynb
file to your Canvas assignment submission.
Practice safe submission! Verify that your HW files were truly submitted correctly, the upload was successful, and that your program runs with no syntax or runtime errors. It is solely your responsibility to turn in your homework and practice this safe submission safeguard.
This procedure helps guard against a few things.