Lab 7: Seaborn#

In this lab you work on applying your new Python skills to work with data - finally!

Note: This lab is deliberately a bit shorter to give you some time to recover from the Project Milestone 3. If you finish early, I recommend getting started on Lab 8!

Objectives#

In this lab you will:

  1. Practice working with data using the pandas package

  2. Practice some data wrangling mathematical operations.

  3. Practice working with the seaborn package.

  4. Practice creating data visualizations.

# Usually all the import statements are at the top of the file

import pandas as pd
import seaborn as sns
import numpy as np
import os
import matplotlib.pyplot as plt

Task 1: Working with data using pandas#

In this part of the lab, we will practice loading in a sample data set using pandas, and doing some basic operations.

1.1: Load in the data#

There is a CSV file (pokemon.csv) inside a directory called data within the lab3A directory.

Your task is to use the pandas read_csv() function to read this dataset, assign it to a dataframe called df, and then print its head also known as the first 5 lines of the dataframe.

Hint: don’t forget to first import pandas as pd to use read_csv and other pandas function.

### Your solution here

1.2: How many total pokemon are there in the dataset?#

Make sure to use the dataframe.count() function to print the total number of entries in each column of the dataframe before you answer!

### Your solution here

1.3: Create a new dataframe df2 that only includes the Pokemon from the first generation.#

Hint: Remember that you can subset dataframes using the [] syntax. More on this here

### Your solution here