{"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"}},"nbformat":4,"nbformat_minor":2,"cells":[{"cell_type":"markdown","source":["# Data Visualization\n","
\n","\n","---\n","Link to slides: [link](https://docs.google.com/presentation/d/1UaBuUSXQEMqzYpIB_sTf5TaSeq-MNG4ny_i2NOemmDo/edit#slide=id.g556781fa9e_4_0) \n","\n","```{jupyter-info}\n","{rel-data-download}`pokemon.csv`\n","```"],"metadata":{}},{"cell_type":"markdown","source":["In Lesson 10, we will discuss the guiding principles for why we want to visualize data and how we can make effective visualizations. In this notebook, we introduce the libraries `matplotlib` and `seaborn` to make visualizations.\n","\n","Before we begin, let's put a word of caution about how to approach learning these libraries:\n","> Trying to memorize all of these function calls and patterns is a ridiculous task. We will throw a lot of new functions at you very quickly and the intent is not for you to be able to memorize them all. The more important thing is to understand how to use them as examples and **adapt** those examples to the problem you are trying to solve. \n",">\n","> The most important thing is to understand the big ideas we highlight about the code we are showing!\n","\n","This means we won't always be able to explain every bit of code. The purpose is to give you some examples that you can run for your own projects or homeworks, even if you don't have the hundreds of pages of documentation memorized (because no one acually does that!).\n","\n","We will discuss how to read documentation more in Lesson 10. This notebook is meant to be an introduction to see the general workflow of the code.\n","\n","We will be using a modified dataset of Pokemon to explore how to visualize our data!"],"metadata":{},"attachments":{}},{"cell_type":"code","execution_count":2,"source":["import pandas as pd\n","\n","data = pd.read_csv('pokemon.csv')\n","\n","data # For display"],"outputs":[{"output_type":"execute_result","data":{"text/plain":[" Num Name Type 1 Type 2 Total HP Attack Defense Sp. Atk \\\n","0 1 Bulbasaur Grass Poison 318 45 49 49 65 \n","1 2 Ivysaur Grass Poison 405 60 62 63 80 \n","2 3 Venusaur Grass Poison 525 80 82 83 100 \n","3 4 Charmander Fire NaN 309 39 52 43 60 \n","4 5 Charmeleon Fire NaN 405 58 64 58 80 \n",".. ... ... ... ... ... ... ... ... ... \n","146 147 Dratini Dragon NaN 300 41 64 45 50 \n","147 148 Dragonair Dragon NaN 420 61 84 65 70 \n","148 149 Dragonite Dragon Flying 600 91 134 95 100 \n","149 150 Mewtwo Psychic NaN 680 106 110 90 154 \n","150 151 Mew Psychic NaN 600 100 100 100 100 \n","\n"," Sp. Def Speed Stage Legendary \n","0 65 45 1 False \n","1 80 60 2 False \n","2 100 80 3 False \n","3 50 65 1 False \n","4 65 80 2 False \n",".. ... ... ... ... \n","146 50 50 1 False \n","147 70 70 2 False \n","148 100 80 3 False \n","149 90 130 1 True \n","150 100 100 1 False \n","\n","[151 rows x 13 columns]"],"text/html":["\n"," | Num | \n","Name | \n","Type 1 | \n","Type 2 | \n","Total | \n","HP | \n","Attack | \n","Defense | \n","Sp. Atk | \n","Sp. Def | \n","Speed | \n","Stage | \n","Legendary | \n","
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n","1 | \n","Bulbasaur | \n","Grass | \n","Poison | \n","318 | \n","45 | \n","49 | \n","49 | \n","65 | \n","65 | \n","45 | \n","1 | \n","False | \n","
1 | \n","2 | \n","Ivysaur | \n","Grass | \n","Poison | \n","405 | \n","60 | \n","62 | \n","63 | \n","80 | \n","80 | \n","60 | \n","2 | \n","False | \n","
2 | \n","3 | \n","Venusaur | \n","Grass | \n","Poison | \n","525 | \n","80 | \n","82 | \n","83 | \n","100 | \n","100 | \n","80 | \n","3 | \n","False | \n","
3 | \n","4 | \n","Charmander | \n","Fire | \n","NaN | \n","309 | \n","39 | \n","52 | \n","43 | \n","60 | \n","50 | \n","65 | \n","1 | \n","False | \n","
4 | \n","5 | \n","Charmeleon | \n","Fire | \n","NaN | \n","405 | \n","58 | \n","64 | \n","58 | \n","80 | \n","65 | \n","80 | \n","2 | \n","False | \n","
... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","
146 | \n","147 | \n","Dratini | \n","Dragon | \n","NaN | \n","300 | \n","41 | \n","64 | \n","45 | \n","50 | \n","50 | \n","50 | \n","1 | \n","False | \n","
147 | \n","148 | \n","Dragonair | \n","Dragon | \n","NaN | \n","420 | \n","61 | \n","84 | \n","65 | \n","70 | \n","70 | \n","70 | \n","2 | \n","False | \n","
148 | \n","149 | \n","Dragonite | \n","Dragon | \n","Flying | \n","600 | \n","91 | \n","134 | \n","95 | \n","100 | \n","100 | \n","80 | \n","3 | \n","False | \n","
149 | \n","150 | \n","Mewtwo | \n","Psychic | \n","NaN | \n","680 | \n","106 | \n","110 | \n","90 | \n","154 | \n","90 | \n","130 | \n","1 | \n","True | \n","
150 | \n","151 | \n","Mew | \n","Psychic | \n","NaN | \n","600 | \n","100 | \n","100 | \n","100 | \n","100 | \n","100 | \n","100 | \n","1 | \n","False | \n","
151 rows × 13 columns
\n","