You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

213 lines
4.2 KiB

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"http://imgur.com/1ZcRyrc.png\" style=\"float: left; margin: 20px; height: 55px\">\n",
"\n",
"## Homework: Plotting With Pandas\n",
"\n",
"_Authors: Kevin Coyle (L.A.)_\n",
"\n",
"---\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Welcome!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Pandas: Plotting Practice Problems\n",
"\n",
"In this homework, you're going to write code for a few problems. \n",
"\n",
"You'll practice the following programming concepts we've covered in class:\n",
"* Plotting with Pandas.\n",
"* Determining best plot given a data set."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### #1. Import Pandas, `Matplotlib.pyplot`, and NumPy. Don't forget the line that makes `matplotlib` render in a Jupyter Notebook!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### #2. Read in the NBA players `csv` into a variable called `nba_df`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This is a data set of NBA players from 2015. The filename is `NBA_players_2015.csv`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### #3. Look at the first five rows of the data set."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### #4. Create a histogram of the `age` column."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### #5. Create a histogram of the `age` column, but change the number of bins to `20`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### #6. Discuss the difference in the two plots and the implications."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"While skewed, the plot with fewer bins leads one to believe that the bin to the right of the highest-numbered age bin is the second largest. The second-largest bin occurs right after 22 and before 25."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### #7. Rename the `position` column `'pos'` with the following `C:5`, `G:1`, and `F:3`. Then create a scatter matrix plot with the `'pos'`, `'pts'`, `'age'`, and `'fg'` columns."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### #8. Plot the number of guards, centers, and forwards in this data set."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The end!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Great job!"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}