{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Title :\n",
"Exercise: Visualization Improvisation\n",
"\n",
"## Description :\n",
"\n",
"For this exercise we would like you to get creative and experiment! \n",
"\n",
"**You have the freedom to plot anything that you'd like from this data**. You're expected to produce **two plots**, both of which should adhere to the principles learned in lecture (e.g., make it clear to understand/digest, effective, simple, not misleading, etc). \n",
"\n",
"Please feel inspired to challenge yourself by making a type of plot you've never made before -- perhaps never even seen before! Give a brief explanation of the reason and usefulness of the plot.\n",
"\n",
"Your data is the Boston housing prices dataset. We will load it directly from sklearn \n",
"\n",
"**Resource**: for tons of great coding examples, visit the matplotlib website."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# CS109A Introduction to Data Science \n",
"\n",
"## Lecture 14, Exercise: Visualization\n",
"\n",
"\n",
"**Harvard University**
\n",
"**Fall 2020**
\n",
"**Instructors**: Pavlos Protopapas, Kevin Rader, and Chris Tanner\n",
"\n",
"---"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from sklearn.datasets import load_boston"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n", " | CRIM | \n", "ZN | \n", "INDUS | \n", "CHAS | \n", "NOX | \n", "RM | \n", "AGE | \n", "DIS | \n", "RAD | \n", "TAX | \n", "PTRATIO | \n", "B | \n", "LSTAT | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
count | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "506.000000 | \n", "
mean | \n", "3.613524 | \n", "11.363636 | \n", "11.136779 | \n", "0.069170 | \n", "0.554695 | \n", "6.284634 | \n", "68.574901 | \n", "3.795043 | \n", "9.549407 | \n", "408.237154 | \n", "18.455534 | \n", "356.674032 | \n", "12.653063 | \n", "
std | \n", "8.601545 | \n", "23.322453 | \n", "6.860353 | \n", "0.253994 | \n", "0.115878 | \n", "0.702617 | \n", "28.148861 | \n", "2.105710 | \n", "8.707259 | \n", "168.537116 | \n", "2.164946 | \n", "91.294864 | \n", "7.141062 | \n", "
min | \n", "0.006320 | \n", "0.000000 | \n", "0.460000 | \n", "0.000000 | \n", "0.385000 | \n", "3.561000 | \n", "2.900000 | \n", "1.129600 | \n", "1.000000 | \n", "187.000000 | \n", "12.600000 | \n", "0.320000 | \n", "1.730000 | \n", "
25% | \n", "0.082045 | \n", "0.000000 | \n", "5.190000 | \n", "0.000000 | \n", "0.449000 | \n", "5.885500 | \n", "45.025000 | \n", "2.100175 | \n", "4.000000 | \n", "279.000000 | \n", "17.400000 | \n", "375.377500 | \n", "6.950000 | \n", "
50% | \n", "0.256510 | \n", "0.000000 | \n", "9.690000 | \n", "0.000000 | \n", "0.538000 | \n", "6.208500 | \n", "77.500000 | \n", "3.207450 | \n", "5.000000 | \n", "330.000000 | \n", "19.050000 | \n", "391.440000 | \n", "11.360000 | \n", "
75% | \n", "3.677083 | \n", "12.500000 | \n", "18.100000 | \n", "0.000000 | \n", "0.624000 | \n", "6.623500 | \n", "94.075000 | \n", "5.188425 | \n", "24.000000 | \n", "666.000000 | \n", "20.200000 | \n", "396.225000 | \n", "16.955000 | \n", "
max | \n", "88.976200 | \n", "100.000000 | \n", "27.740000 | \n", "1.000000 | \n", "0.871000 | \n", "8.780000 | \n", "100.000000 | \n", "12.126500 | \n", "24.000000 | \n", "711.000000 | \n", "22.000000 | \n", "396.900000 | \n", "37.970000 | \n", "