Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions lecture_4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,50 @@
}
},
"source": [
"As an example, we'll look at the frequency of 311 requests:\n",
"Simple time series: The population data."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"districts = pd.read_csv('https://storage.googleapis.com/python-public-policy/data/311_community_districts.csv.zip')\n",
"districts.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"Helpful function for looking at changes over time: [`pct_change()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pct_change.html)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"discticts.pct_change(axis='columns')"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"Next, we'll look at the frequency of 311 requests:\n",
"\n",
"- Over time\n",
"- By day of the week\n",
Expand Down Expand Up @@ -106,7 +149,6 @@
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import plotly.express as px\n",
"\n",
"# boilerplate for allowing PDF export\n",
Expand Down