In [1]:
import pandas as pd
import numpy as np
In [2]:
dogdata = pd.read_csv("dogdata.csv")
In [3]:
dogdata.head()
In [4]:
# Question 2: Handling missing values
# Try out your methods here
In [5]:
# Question 3: Counting categorical data
# Test code here
In [6]:
# Question 4: Filtering and grouping data
In [7]:
# Question 5: Pudgy puppies
In [8]:
# Question 6: Vectorizing Code
clifford_data = pd.read_csv("bigdogdata.csv")
In [9]:
# Our example of non-vectorized code
fursums = {"curly": 0, "short": 0, "long": 0}
furcounts = {"curly": 0, "short": 0, "long": 0}
for name, fur, height, age in clifford_data.values:
if len(name) > 5:
fursums[fur] += height
furcounts[fur] += 1
print([i + ": " + str(fursums[i]/furcounts[i]) for i in fursums.keys()])
In [10]:
# Your code here!
In [ ]: