1 00:00:00,480 --> 00:00:04,450 What is the average or mean attack for each type? 2 00:00:04,450 --> 00:00:08,021 And what is the count of Pokemon for each type? 3 00:00:08,021 --> 00:00:10,263 To answer our last two questions, 4 00:00:10,263 --> 00:00:15,460 we will use the cat plot sub family of estimation plots with bar and count plots. 5 00:00:17,520 --> 00:00:19,516 Let's start with the barplot. 6 00:00:19,516 --> 00:00:24,741 sns.catplot (kind='bar', 7 00:00:27,525 --> 00:00:34,848 data=pokemon, x='Type', 8 00:00:34,848 --> 00:00:39,558 and y='Attack'). 9 00:00:39,558 --> 00:00:42,319 Oops, and let's remember to fix the aspect. 10 00:00:45,360 --> 00:00:47,786 Aspect=2. 11 00:00:49,275 --> 00:00:50,962 Beautiful. 12 00:00:50,962 --> 00:00:56,000 Seaborn's bar plot shows the mean or average values for each category of data. 13 00:00:57,010 --> 00:01:01,150 It is in the categorical estimate sub family because it shows 14 00:01:01,150 --> 00:01:03,516 an estimate of central tendency. 15 00:01:03,516 --> 00:01:08,464 The black lines on each bar are error bars that represent uncertainty, 16 00:01:08,464 --> 00:01:11,691 like if there are outliers in our observations. 17 00:01:11,691 --> 00:01:18,020 As we can see here, for water there is a mean of 70. 18 00:01:18,020 --> 00:01:23,067 For grass it looks to be just about 60, 19 00:01:23,067 --> 00:01:30,200 Electric 75, Rock maybe 70, Ground 75 and so on. 20 00:01:30,200 --> 00:01:34,720 I'll record my observations and I'll catch you after the break. 21 00:01:36,360 --> 00:01:42,130 So I've recorded my average attack by type observations into a markdown table. 22 00:01:42,130 --> 00:01:44,505 This is what it looks like in raw form so 23 00:01:44,505 --> 00:01:48,430 that you can see how to make a table in markdown. 24 00:01:48,430 --> 00:01:50,372 When I hit Shift Return, 25 00:01:50,372 --> 00:01:55,009 I get a neatly formatted table in my Jupyter Notebook here. 26 00:01:55,009 --> 00:01:59,362 So average attack by type, Water 85, Grass 60, 27 00:01:59,362 --> 00:02:03,730 Electric 75, Rock 70, Ground 75, and so on. 28 00:02:05,670 --> 00:02:08,004 Let's answer our second question now. 29 00:02:08,004 --> 00:02:11,230 What is the count of Pokemon for each type? 30 00:02:11,230 --> 00:02:14,002 If we want to count each type of Pokemon, 31 00:02:14,002 --> 00:02:17,434 we can change the kind keyword argument to count. 32 00:02:17,434 --> 00:02:23,000 But unlike the bar plot, the count plot only needs one axis of data. 33 00:02:23,000 --> 00:02:23,943 Let's look at that. 34 00:02:23,943 --> 00:02:26,706 sns.catplot. 35 00:02:28,594 --> 00:02:31,548 Kind=count. 36 00:02:33,180 --> 00:02:35,302 Data=pokemon. 37 00:02:38,870 --> 00:02:41,387 X='Type'. 38 00:02:41,387 --> 00:02:47,301 For the count plot, unlike the bar plot we only need one axis of data. 39 00:02:47,301 --> 00:02:49,010 Let's run that. 40 00:02:49,010 --> 00:02:52,384 My cell was a markdown. 41 00:02:52,384 --> 00:02:54,392 So, let's change that to code. 42 00:02:56,273 --> 00:02:56,930 There we go. 43 00:02:58,950 --> 00:03:05,095 And whoops, I didn't adjust the aspect, so let's do that there, too, aspect=2. 44 00:03:07,788 --> 00:03:10,147 Beautiful. 45 00:03:10,147 --> 00:03:13,973 So, if we want to count each type of Pokemon, 46 00:03:13,973 --> 00:03:19,031 we only need one axis of data, and I set the x-axis to type. 47 00:03:21,220 --> 00:03:24,937 The most common types of Pokemon are normal and psychic. 48 00:03:24,937 --> 00:03:25,520 Nice. 49 00:03:26,720 --> 00:03:30,532 I'll make a table with a count of all my observations and 50 00:03:30,532 --> 00:03:32,813 I'll catch you after the break. 51 00:03:32,813 --> 00:03:37,770 So I've made my table here with counter Pokemon by type. 52 00:03:37,770 --> 00:03:44,790 I've got 4 Water, 4 Grass, 2 Electric, 2 Rock, 3 Ground, and so on. 53 00:03:44,790 --> 00:03:49,367 With the combination of vertical pipes and dashes, I'm able to make tables and 54 00:03:49,367 --> 00:03:52,720 markdown, and you should be able to, too. 55 00:03:52,720 --> 00:03:58,152 It's a neat way to present your data in these Jupyter notebooks, 56 00:03:58,152 --> 00:04:02,611 and it it's just helpful to have the data at a glance. 57 00:04:02,611 --> 00:04:08,017 Now that we've answered our two questions, What is the average mean attack for 58 00:04:08,017 --> 00:04:11,980 each type, and what is the count of Pokemon for each type? 59 00:04:13,030 --> 00:04:18,263 Try making a bar plot that finds the average defense for 60 00:04:18,263 --> 00:04:22,259 each type, and make a table in markdown. 61 00:04:22,259 --> 00:04:25,171 I'll leave this here so you can see the format again, 62 00:04:25,171 --> 00:04:29,323 try making a table in markdown that summarizes your findings from the plot.