Question: use Pandas in Python for the following data write the function for problem 5 you don't need to worry about read the file, only the
use Pandas in Python
for the following data
write the function for problem 5
you don't need to worry about read the file, only the function will be fun.
the output should be something similar to {'fire': 2, 'water' : 3}


1 id, name, level, personality, type, weakness, atk, def, hp, stage 2 53, Persian, 40,mild, normal, fighting, 104, 116, 147,2 3 126, Magmar, 44, docile, fire, water,96,83,153,1 4 99, Kingler,33, adamant,water, electric,110,169,29,2 5 57,Primeape ,9, lonely, fighting, flying, 20,66,43,2 6 3, Venusaur, 44, sassy, grass, fire, 136,195,92,3 7 23, Ekans , 81, hasty,poison, psychic,30,108,20,1 8 11, Metapod, 4, naive, grass, fire, 30,114,22,2 9 126, Magmar,96,modest, fire, water,62,114,155,1 O 137, Porygon, 96, relaxed, normal, fighting, 68,50,127,1 1 69,Bellsprout,84, lonely,grass, fire, 149,32,45,1 2 10,Caterpie,3, serious, bug, flying,7,10,15,1 3 12, Butterfree, 12, hasty, bug, flying, 20,25,35,3 4 35,Clefairy, 18, impish, fairy,poison, 33,25,50,1 5 23, Ekans, 15, Jolly,poison, psychic,40,15,35,1 Problem 5: count_types Write a function called count_types that returns a dictionary with keys that are Pokemon types and values that are the number of times that type appears in the dataset. The order of the keys in the dictionary does not matter. Note that you will want to return a Python dictionary for this function so you will have to convert from a pandas object to a dictionary. 1 id, name, level, personality, type, weakness, atk, def, hp, stage 2 53, Persian, 40,mild, normal, fighting, 104, 116, 147,2 3 126, Magmar, 44, docile, fire, water,96,83,153,1 4 99, Kingler,33, adamant,water, electric,110,169,29,2 5 57,Primeape ,9, lonely, fighting, flying, 20,66,43,2 6 3, Venusaur, 44, sassy, grass, fire, 136,195,92,3 7 23, Ekans , 81, hasty,poison, psychic,30,108,20,1 8 11, Metapod, 4, naive, grass, fire, 30,114,22,2 9 126, Magmar,96,modest, fire, water,62,114,155,1 O 137, Porygon, 96, relaxed, normal, fighting, 68,50,127,1 1 69,Bellsprout,84, lonely,grass, fire, 149,32,45,1 2 10,Caterpie,3, serious, bug, flying,7,10,15,1 3 12, Butterfree, 12, hasty, bug, flying, 20,25,35,3 4 35,Clefairy, 18, impish, fairy,poison, 33,25,50,1 5 23, Ekans, 15, Jolly,poison, psychic,40,15,35,1 Problem 5: count_types Write a function called count_types that returns a dictionary with keys that are Pokemon types and values that are the number of times that type appears in the dataset. The order of the keys in the dictionary does not matter. Note that you will want to return a Python dictionary for this function so you will have to convert from a pandas object to a dictionary
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
