![compare pokemon by stats compare pokemon by stats](http://pm1.narvii.com/5831/e0bfc8927a2af0f1bfecdf43c85caee607614f03_hq.jpg)
We can use this graph to find out interesting information about the relationship between the attack and defense of pokemon. The Scatterplot allows you to plot individual values along both an x and a y coordinate. The final bottom line shows the weakest strength for that category. The bottom of the box represents the 25% percentile, so 25% of pokemon are weaker than that value. The middle of the box is the average strength (mean) for that category. Where the box ends at the top represents the 75% percentile, so 25% of pokemon are stronger than the end of the box. The top line shows the highest value for the category (Max). Poke_common.boxplot(column='Total', by='Type 1') By using this chart, we can see that some pokemon have higher stats in certain areas than others.įor our boxplot we're going to try to answer the question: which pokemon type is generally the strongest? Instead of checking which type has the single strongest pokemon, by looking at the range of strength for all pokemon in that type we can come up with the type where you are likely to find a strong pokemon. This is a Stacked Bar Chart and is useful when showing how a total is broken down into different parts. Plt.title("Ash's Pokemon Team Stats Breakdown") Plt.bar(poke_ash, special_defense_stats, bottom=(hp_stats+attack_stats+defense_stats+speed_stats+special_attack_stats), color='#440044') Plt.bar(poke_ash, special_attack_stats, bottom=(hp_stats+attack_stats+defense_stats+speed_stats), color='#990099') Plt.bar(poke_ash, speed_stats, bottom=(hp_stats+attack_stats+defense_stats), color='#ffff00') Plt.bar(poke_ash, defense_stats, bottom=(hp_stats+attack_stats), color='#0000ff') Plt.bar(poke_ash, attack_stats, bottom=hp_stats, color='#ff0000') Instead of viewing the sum totals of each pokemon's stats, how about we view all the parts individually? The total stats of a pokemon are composed of multiple parts. Scatterplot: Useful when you have a large number of data points across two axes, and you want to find where there are clusters of data Boxplot: Helpful when you want to show how wide a range of potential values isģ. Stacked Bar Chart: Use this chart type when you want to break down one bar into multiple parts.Ģ.
Compare pokemon by stats code#
Running the below code will create 2 graphs, not just one. This lets us create information for each graph at a time, and then show both of them at the end so we can compare the results. Poke_gary = poke.isin(gary_list)]įinally, we create two separate graphs by using the plt.figure() function. It will get all the rows from the dataframe where the values match the values in our lists. Next, we can use the isin() function for our filter. Now that we know the two team compositions, let's compose two different dataframes of the teams.įirst, we create two lists of each of the teams.Īsh_list =
Compare pokemon by stats how to#
If he wants a more powerful pokemon than pikachu on his team, what pokemon should he pick? We've already shown how to rank order pokemon by power in the previous lesson, now we're going to illustrate the power of pokemon in a chart so Ash can make a good decision. It's time to make a recommendation to Ash. By being more specific, it looks like pikachu's stats look even worse by comparison. But let's compare pikachu with just the pokemon from generation 1, then compare pikachu with just the other electric types from generation 1. Poke_common = poke_stats = False) & (~('Mega'))].drop_duplicates('Name', keep='first')įine, you've now got the data that shows that pikachu is below average for all the pokemon. You can decide whether or not you want to break this up into multiple steps, or do it all on one line. Let's re-do the math only comparing pikachu to other common pokemon, and remove duplicates as well. "But wait!" Ash tells you, "You can't compare pikachu's power to legendary and mega pokemon!" You try to break the news gently to Ash that pikachu isn't actually the best pokemon or even above average. We'll use the mean() aggregator to determine what the average pokemon's strength is. This gives us simplified table that we can use to compare pokemon by their stats, poke_stats(), and we can now see that Pikachu's total power is 320. Then, we'll take a look at Pikachu again.
![compare pokemon by stats compare pokemon by stats](http://pm1.narvii.com/6109/90997d4133884b50f930c549f90b5a2e46300dc3_hq.jpg)
Next, we're going to make a subset of our data with only 5 columns. We'll do the pandas import like we did last time, and we'll also import the necessary plotting functionality from matplotlib.
Compare pokemon by stats download#
If you don't have the file, you can download it again here: Pokemon.csv First, make sure that the Pokemon.csv you downloaded is in the same location, and create a new python file called "pokemonGraphs.py"