Initial commit

master
Khiem Ton 2 years ago
commit 8ce038c469
Signed by: th4tkh13m
GPG Key ID: 4D9CF147DCADD05D

@ -0,0 +1,462 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>\n",
"___\n",
"# Python Crash Course Exercises \n",
"\n",
"This is an optional exercise to test your understanding of Python Basics. If you find this extremely challenging, then you probably are not ready for the rest of this course yet and don't have enough programming experience to continue. I would suggest you take another course more geared towards complete beginners, such as [Complete Python Bootcamp](https://www.udemy.com/complete-python-bootcamp/?couponCode=PY20)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercises\n",
"\n",
"Answer the questions or complete the tasks outlined in bold below, use the specific method described if applicable."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** What is 7 to the power of 4?**"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2401"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Split this string:**\n",
"\n",
" s = \"Hi there Sam!\"\n",
" \n",
"**into a list. **"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Hi', 'there', 'dad!']"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Given the variables:**\n",
"\n",
" planet = \"Earth\"\n",
" diameter = 12742\n",
"\n",
"** Use .format() to print the following string: **\n",
"\n",
" The diameter of Earth is 12742 kilometers."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"planet = \"Earth\"\n",
"diameter = 12742"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The diameter of Earth is 12742 kilometers.\n"
]
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Given this nested list, use indexing to grab the word \"hello\" **"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"lst = [1,2,[3,4],[5,[100,200,['hello']],23,11],1,7]"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'hello'"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Given this nested dictionary grab the word \"hello\". Be prepared, this will be annoying/tricky **"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"d = {'k1':[1,2,3,{'tricky':['oh','man','inception',{'target':[1,2,3,'hello']}]}]}"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'hello'"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** What is the main difference between a tuple and a list? **"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Tuple is immutable"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Create a function that grabs the email website domain from a string in the form: **\n",
"\n",
" user@domain.com\n",
" \n",
"**So for example, passing \"user@domain.com\" would return: domain.com**"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'domain.com'"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"domainGet('user@domain.com')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Create a basic function that returns True if the word 'dog' is contained in the input string. Don't worry about edge cases like a punctuation being attached to the word dog, but do account for capitalization. **"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"findDog('Is there a dog here?')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Create a function that counts the number of times the word \"dog\" occurs in a string. Again ignore edge cases. **"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"countDog('This dog runs faster than the other dog dude!')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Use lambda expressions and the filter() function to filter out words from a list that don't start with the letter 's'. For example:**\n",
"\n",
" seq = ['soup','dog','salad','cat','great']\n",
"\n",
"**should be filtered down to:**\n",
"\n",
" ['soup','salad']"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"seq = ['soup','dog','salad','cat','great']"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['soup', 'salad']"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Final Problem\n",
"**You are driving a little too fast, and a police officer stops you. Write a function\n",
" to return one of 3 possible results: \"No ticket\", \"Small ticket\", or \"Big Ticket\". \n",
" If your speed is 60 or less, the result is \"No Ticket\". If speed is between 61 \n",
" and 80 inclusive, the result is \"Small Ticket\". If speed is 81 or more, the result is \"Big Ticket\". Unless it is your birthday (encoded as a boolean value in the parameters of the function) -- on your birthday, your speed can be 5 higher in all \n",
" cases. **"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def caught_speeding(speed, is_birthday):\n",
" pass"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Small Ticket'"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"caught_speeding(81,True)"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Big Ticket'"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"caught_speeding(81,False)"
]
},
{
"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.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,462 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>\n",
"___\n",
"# Python Crash Course Exercises \n",
"\n",
"This is an optional exercise to test your understanding of Python Basics. If you find this extremely challenging, then you probably are not ready for the rest of this course yet and don't have enough programming experience to continue. I would suggest you take another course more geared towards complete beginners, such as [Complete Python Bootcamp](https://www.udemy.com/complete-python-bootcamp/?couponCode=PY20)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercises\n",
"\n",
"Answer the questions or complete the tasks outlined in bold below, use the specific method described if applicable."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** What is 7 to the power of 4?**"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2401"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Split this string:**\n",
"\n",
" s = \"Hi there Sam!\"\n",
" \n",
"**into a list. **"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Hi', 'there', 'dad!']"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Given the variables:**\n",
"\n",
" planet = \"Earth\"\n",
" diameter = 12742\n",
"\n",
"** Use .format() to print the following string: **\n",
"\n",
" The diameter of Earth is 12742 kilometers."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"planet = \"Earth\"\n",
"diameter = 12742"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The diameter of Earth is 12742 kilometers.\n"
]
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Given this nested list, use indexing to grab the word \"hello\" **"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"lst = [1,2,[3,4],[5,[100,200,['hello']],23,11],1,7]"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'hello'"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Given this nested dictionary grab the word \"hello\". Be prepared, this will be annoying/tricky **"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"d = {'k1':[1,2,3,{'tricky':['oh','man','inception',{'target':[1,2,3,'hello']}]}]}"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'hello'"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** What is the main difference between a tuple and a list? **"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Tuple is immutable"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Create a function that grabs the email website domain from a string in the form: **\n",
"\n",
" user@domain.com\n",
" \n",
"**So for example, passing \"user@domain.com\" would return: domain.com**"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'domain.com'"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"domainGet('user@domain.com')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Create a basic function that returns True if the word 'dog' is contained in the input string. Don't worry about edge cases like a punctuation being attached to the word dog, but do account for capitalization. **"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"findDog('Is there a dog here?')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Create a function that counts the number of times the word \"dog\" occurs in a string. Again ignore edge cases. **"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"countDog('This dog runs faster than the other dog dude!')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Use lambda expressions and the filter() function to filter out words from a list that don't start with the letter 's'. For example:**\n",
"\n",
" seq = ['soup','dog','salad','cat','great']\n",
"\n",
"**should be filtered down to:**\n",
"\n",
" ['soup','salad']"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"seq = ['soup','dog','salad','cat','great']"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['soup', 'salad']"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Final Problem\n",
"**You are driving a little too fast, and a police officer stops you. Write a function\n",
" to return one of 3 possible results: \"No ticket\", \"Small ticket\", or \"Big Ticket\". \n",
" If your speed is 60 or less, the result is \"No Ticket\". If speed is between 61 \n",
" and 80 inclusive, the result is \"Small Ticket\". If speed is 81 or more, the result is \"Big Ticket\". Unless it is your birthday (encoded as a boolean value in the parameters of the function) -- on your birthday, your speed can be 5 higher in all \n",
" cases. **"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def caught_speeding(speed, is_birthday):\n",
" pass"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Small Ticket'"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"caught_speeding(81,True)"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Big Ticket'"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"caught_speeding(81,False)"
]
},
{
"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.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

@ -0,0 +1,500 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>\n",
"___\n",
"# Python Crash Course Exercises - Solutions\n",
"\n",
"This is an optional exercise to test your understanding of Python Basics. If you find this extremely challenging, then you probably are not ready for the rest of this course yet and don't have enough programming experience to continue. I would suggest you take another course more geared towards complete beginners, such as [Complete Python Bootcamp](https://www.udemy.com/complete-python-bootcamp/?couponCode=PY20)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercises\n",
"\n",
"Answer the questions or complete the tasks outlined in bold below, use the specific method described if applicable."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** What is 7 to the power of 4?**"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2401"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"7**4"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Split this string:**\n",
"\n",
" s = \"Hi there Sam!\"\n",
" \n",
"**into a list. **"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"s = 'Hi there Sam!'"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Hi', 'there', 'dad!']"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s.split()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Given the variables:**\n",
"\n",
" planet = \"Earth\"\n",
" diameter = 12742\n",
"\n",
"** Use .format() to print the following string: **\n",
"\n",
" The diameter of Earth is 12742 kilometers."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"planet = \"Earth\"\n",
"diameter = 12742"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The diameter of Earth is 12742 kilometers.\n"
]
}
],
"source": [
"print(\"The diameter of {} is {} kilometers.\".format(planet,diameter))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Given this nested list, use indexing to grab the word \"hello\" **"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"lst = [1,2,[3,4],[5,[100,200,['hello']],23,11],1,7]"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'hello'"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lst[3][1][2][0]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Given this nest dictionary grab the word \"hello\". Be prepared, this will be annoying/tricky **"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"d = {'k1':[1,2,3,{'tricky':['oh','man','inception',{'target':[1,2,3,'hello']}]}]}"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'hello'"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d['k1'][3]['tricky'][3]['target'][3]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** What is the main difference between a tuple and a list? **"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Tuple is immutable"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Create a function that grabs the email website domain from a string in the form: **\n",
"\n",
" user@domain.com\n",
" \n",
"**So for example, passing \"user@domain.com\" would return: domain.com**"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def domainGet(email):\n",
" return email.split('@')[-1]"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'domain.com'"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"domainGet('user@domain.com')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Create a basic function that returns True if the word 'dog' is contained in the input string. Don't worry about edge cases like a punctuation being attached to the word dog, but do account for capitalization. **"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def findDog(st):\n",
" return 'dog' in st.lower().split()"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"findDog('Is there a dog here?')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Create a function that counts the number of times the word \"dog\" occurs in a string. Again ignore edge cases. **"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"def countDog(st):\n",
" count = 0\n",
" for word in st.lower().split():\n",
" if word == 'dog':\n",
" count += 1\n",
" return count"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"countDog('This dog runs faster than the other dog dude!')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** Use lambda expressions and the filter() function to filter out words from a list that don't start with the letter 's'. For example:**\n",
"\n",
" seq = ['soup','dog','salad','cat','great']\n",
"\n",
"**should be filtered down to:**\n",
"\n",
" ['soup','salad']"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"seq = ['soup','dog','salad','cat','great']"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['soup', 'salad']"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"list(filter(lambda word: word[0]=='s',seq))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Final Problem\n",
"**You are driving a little too fast, and a police officer stops you. Write a function\n",
" to return one of 3 possible results: \"No ticket\", \"Small ticket\", or \"Big Ticket\". \n",
" If your speed is 60 or less, the result is \"No Ticket\". If speed is between 61 \n",
" and 80 inclusive, the result is \"Small Ticket\". If speed is 81 or more, the result is \"Big Ticket\". Unless it is your birthday (encoded as a boolean value in the parameters of the function) -- on your birthday, your speed can be 5 higher in all \n",
" cases. **"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def caught_speeding(speed, is_birthday):\n",
" \n",
" if is_birthday:\n",
" speeding = speed - 5\n",
" else:\n",
" speeding = speed\n",
" \n",
" if speeding > 80:\n",
" return 'Big Ticket'\n",
" elif speeding > 60:\n",
" return 'Small Ticket'\n",
" else:\n",
" return 'No Ticket'"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Small Ticket'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"caught_speeding(81,True)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Big Ticket'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"caught_speeding(81,False)"
]
},
{
"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.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,539 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright Pierian Data</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"# NumPy Operations"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Arithmetic\n",
"\n",
"You can easily perform *array with array* arithmetic, or *scalar with array* arithmetic. Let's see some examples:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"arr = np.arange(0,10)\n",
"arr"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18])"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr + arr"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81])"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr * arr"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr - arr"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Anaconda3\\envs\\tsa_course\\lib\\site-packages\\ipykernel_launcher.py:3: RuntimeWarning: invalid value encountered in true_divide\n",
" This is separate from the ipykernel package so we can avoid doing imports until\n"
]
},
{
"data": {
"text/plain": [
"array([nan, 1., 1., 1., 1., 1., 1., 1., 1., 1.])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# This will raise a Warning on division by zero, but not an error!\n",
"# It just fills the spot with nan\n",
"arr/arr"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Anaconda3\\envs\\tsa_course\\lib\\site-packages\\ipykernel_launcher.py:2: RuntimeWarning: divide by zero encountered in true_divide\n",
" \n"
]
},
{
"data": {
"text/plain": [
"array([ inf, 1. , 0.5 , 0.33333333, 0.25 ,\n",
" 0.2 , 0.16666667, 0.14285714, 0.125 , 0.11111111])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Also a warning (but not an error) relating to infinity\n",
"1/arr"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 1, 8, 27, 64, 125, 216, 343, 512, 729], dtype=int32)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr**3"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Universal Array Functions\n",
"\n",
"NumPy comes with many [universal array functions](http://docs.scipy.org/doc/numpy/reference/ufuncs.html), or <em>ufuncs</em>, which are essentially just mathematical operations that can be applied across the array.<br>Let's show some common ones:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0. , 1. , 1.41421356, 1.73205081, 2. ,\n",
" 2.23606798, 2.44948974, 2.64575131, 2.82842712, 3. ])"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Taking Square Roots\n",
"np.sqrt(arr)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1.00000000e+00, 2.71828183e+00, 7.38905610e+00, 2.00855369e+01,\n",
" 5.45981500e+01, 1.48413159e+02, 4.03428793e+02, 1.09663316e+03,\n",
" 2.98095799e+03, 8.10308393e+03])"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Calculating exponential (e^)\n",
"np.exp(arr)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0. , 0.84147098, 0.90929743, 0.14112001, -0.7568025 ,\n",
" -0.95892427, -0.2794155 , 0.6569866 , 0.98935825, 0.41211849])"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Trigonometric Functions like sine\n",
"np.sin(arr)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Anaconda3\\envs\\tsa_course\\lib\\site-packages\\ipykernel_launcher.py:2: RuntimeWarning: divide by zero encountered in log\n",
" \n"
]
},
{
"data": {
"text/plain": [
"array([ -inf, 0. , 0.69314718, 1.09861229, 1.38629436,\n",
" 1.60943791, 1.79175947, 1.94591015, 2.07944154, 2.19722458])"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Taking the Natural Logarithm\n",
"np.log(arr)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Summary Statistics on Arrays\n",
"\n",
"NumPy also offers common summary statistics like <em>sum</em>, <em>mean</em> and <em>max</em>. You would call these as methods on an array."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr = np.arange(0,10)\n",
"arr"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"45"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr.sum()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4.5"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr.mean()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"9"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr.max()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<strong>Other summary statistics include:</strong>\n",
"<pre>\n",
"arr.min() returns 0 minimum\n",
"arr.var() returns 8.25 variance\n",
"arr.std() returns 2.8722813232690143 standard deviation\n",
"</pre>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Axis Logic\n",
"When working with 2-dimensional arrays (matrices) we have to consider rows and columns. This becomes very important when we get to the section on pandas. In array terms, axis 0 (zero) is the vertical axis (rows), and axis 1 is the horizonal axis (columns). These values (0,1) correspond to the order in which <tt>arr.shape</tt> values are returned.\n",
"\n",
"Let's see how this affects our summary statistic calculations from above."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 1, 2, 3, 4],\n",
" [ 5, 6, 7, 8],\n",
" [ 9, 10, 11, 12]])"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr_2d = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]])\n",
"arr_2d"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([15, 18, 21, 24])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr_2d.sum(axis=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By passing in <tt>axis=0</tt>, we're returning an array of sums along the vertical axis, essentially <tt>[(1+5+9), (2+6+10), (3+7+11), (4+8+12)]</tt>\n",
"\n",
"<img src='axis_logic.png' width=400/>"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(3, 4)"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr_2d.shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This tells us that <tt>arr_2d</tt> has 3 rows and 4 columns.\n",
"\n",
"In <tt>arr_2d.sum(axis=0)</tt> above, the first element in each row was summed, then the second element, and so forth.\n",
"\n",
"So what should <tt>arr_2d.sum(axis=1)</tt> return?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# THINK ABOUT WHAT THIS WILL RETURN BEFORE RUNNING THE CELL!\n",
"arr_2d.sum(axis=1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Great Job!\n",
"\n",
"That's all we need to know for now!"
]
}
],
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

@ -0,0 +1,850 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright Pierian Data</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# NumPy Exercises\n",
"\n",
"Now that we've learned about NumPy let's test your knowledge. We'll start off with a few simple tasks and then you'll be asked some more complicated questions.\n",
"\n",
"<div class=\"alert alert-danger\" style=\"margin: 10px\"><strong>IMPORTANT NOTE!</strong> Make sure you don't run the cells directly above the example output shown, <br>otherwise you will end up writing over the example output!</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 1. Import NumPy as np"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 2. Create an array of 10 zeros "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# CODE HERE\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 3. Create an array of 10 ones"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 4. Create an array of 10 fives"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([5., 5., 5., 5., 5., 5., 5., 5., 5., 5.])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 5. Create an array of the integers from 10 to 50"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,\n",
" 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,\n",
" 44, 45, 46, 47, 48, 49, 50])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 6. Create an array of all the even integers from 10 to 50"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42,\n",
" 44, 46, 48, 50])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 7. Create a 3x3 matrix with values ranging from 0 to 8"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0, 1, 2],\n",
" [3, 4, 5],\n",
" [6, 7, 8]])"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 8. Create a 3x3 identity matrix"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1., 0., 0.],\n",
" [0., 1., 0.],\n",
" [0., 0., 1.]])"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 9. Use NumPy to generate a random number between 0 and 1<br><br>&emsp;NOTE: Your result's value should be different from the one shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0.65248055])"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 10. Use NumPy to generate an array of 25 random numbers sampled from a standard normal distribution<br><br>&emsp;&ensp;NOTE: Your result's values should be different from the ones shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 1.80076712, -1.12375847, -0.98524305, 0.11673573, 1.96346762,\n",
" 1.81378592, -0.33790771, 0.85012656, 0.0100703 , -0.91005957,\n",
" 0.29064366, 0.69906357, 0.1774377 , -0.61958694, -0.45498611,\n",
" -2.0804685 , -0.06778549, 1.06403819, 0.4311884 , -1.09853837,\n",
" 1.11980469, -0.48751963, 1.32517611, -0.61775122, -0.00622865])"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 11. Create the following matrix:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1 ],\n",
" [0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2 ],\n",
" [0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3 ],\n",
" [0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4 ],\n",
" [0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5 ],\n",
" [0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6 ],\n",
" [0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.7 ],\n",
" [0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.8 ],\n",
" [0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9 ],\n",
" [0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1. ]])"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 12. Create an array of 20 linearly spaced points between 0 and 1:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0. , 0.05263158, 0.10526316, 0.15789474, 0.21052632,\n",
" 0.26315789, 0.31578947, 0.36842105, 0.42105263, 0.47368421,\n",
" 0.52631579, 0.57894737, 0.63157895, 0.68421053, 0.73684211,\n",
" 0.78947368, 0.84210526, 0.89473684, 0.94736842, 1. ])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Numpy Indexing and Selection\n",
"\n",
"Now you will be given a starting matrix (be sure to run the cell below!), and be asked to replicate the resulting matrix outputs:"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 1, 2, 3, 4, 5],\n",
" [ 6, 7, 8, 9, 10],\n",
" [11, 12, 13, 14, 15],\n",
" [16, 17, 18, 19, 20],\n",
" [21, 22, 23, 24, 25]])"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# RUN THIS CELL - THIS IS OUR STARTING MATRIX\n",
"mat = np.arange(1,26).reshape(5,5)\n",
"mat"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 13. Write code that reproduces the output shown below.<br><br>&emsp;&ensp;Be careful not to run the cell immediately above the output, otherwise you won't be able to see the output any more."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# CODE HERE\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[12, 13, 14, 15],\n",
" [17, 18, 19, 20],\n",
" [22, 23, 24, 25]])"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 14. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 15. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 2],\n",
" [ 7],\n",
" [12]])"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 16. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([21, 22, 23, 24, 25])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 17. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[16, 17, 18, 19, 20],\n",
" [21, 22, 23, 24, 25]])"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## NumPy Operations"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 18. Get the sum of all the values in mat"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"325"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 19. Get the standard deviation of the values in mat"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7.211102550927978"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 20. Get the sum of all the columns in mat"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([55, 60, 65, 70, 75])"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Bonus Question\n",
"\n",
"We worked a lot with random data with numpy, but is there a way we can insure that we always get the same random numbers? [Click Here for a Hint](https://www.google.com/search?q=numpy+random+seed&rlz=1C1CHBF_enUS747US747&oq=numpy+random+seed&aqs=chrome..69i57j69i60j0l4.2087j0j7&sourceid=chrome&ie=UTF-8)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"# Great Job!"
]
}
],
"metadata": {
"anaconda-cloud": {},
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,652 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright Pierian Data</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# NumPy Indexing and Selection\n",
"\n",
"In this lecture we will discuss how to select elements or groups of elements from an array."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#Creating sample array\n",
"arr = np.arange(0,11)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Show\n",
"arr"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Bracket Indexing and Selection\n",
"The simplest way to pick one or some elements of an array looks very similar to python lists:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Get a value at an index\n",
"arr[8]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1, 2, 3, 4])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Get values in a range\n",
"arr[1:5]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 1, 2, 3, 4])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Get values in a range\n",
"arr[0:5]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Broadcasting\n",
"\n",
"NumPy arrays differ from normal Python lists because of their ability to broadcast. With lists, you can only reassign parts of a list with new parts of the same size and shape. That is, if you wanted to replace the first 5 elements in a list with a new value, you would have to pass in a new 5 element list. With NumPy arrays, you can broadcast a single value across a larger set of values:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([100, 100, 100, 100, 100, 5, 6, 7, 8, 9, 10])"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Setting a value with index range (Broadcasting)\n",
"arr[0:5]=100\n",
"\n",
"#Show\n",
"arr"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Reset array, we'll see why I had to reset in a moment\n",
"arr = np.arange(0,11)\n",
"\n",
"#Show\n",
"arr"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 1, 2, 3, 4, 5])"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Important notes on Slices\n",
"slice_of_arr = arr[0:6]\n",
"\n",
"#Show slice\n",
"slice_of_arr"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([99, 99, 99, 99, 99, 99])"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Change Slice\n",
"slice_of_arr[:]=99\n",
"\n",
"#Show Slice again\n",
"slice_of_arr"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now note the changes also occur in our original array!"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([99, 99, 99, 99, 99, 99, 6, 7, 8, 9, 10])"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Data is not copied, it's a view of the original array! This avoids memory problems!"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([99, 99, 99, 99, 99, 99, 6, 7, 8, 9, 10])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#To get a copy, need to be explicit\n",
"arr_copy = arr.copy()\n",
"\n",
"arr_copy"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Indexing a 2D array (matrices)\n",
"\n",
"The general format is **arr_2d[row][col]** or **arr_2d[row,col]**. I recommend using the comma notation for clarity."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 5, 10, 15],\n",
" [20, 25, 30],\n",
" [35, 40, 45]])"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr_2d = np.array(([5,10,15],[20,25,30],[35,40,45]))\n",
"\n",
"#Show\n",
"arr_2d"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([20, 25, 30])"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Indexing row\n",
"arr_2d[1]"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Format is arr_2d[row][col] or arr_2d[row,col]\n",
"\n",
"# Getting individual element value\n",
"arr_2d[1][0]"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Getting individual element value\n",
"arr_2d[1,0]"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[10, 15],\n",
" [25, 30]])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# 2D array slicing\n",
"\n",
"#Shape (2,2) from top right corner\n",
"arr_2d[:2,1:]"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([35, 40, 45])"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Shape bottom row\n",
"arr_2d[2]"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([35, 40, 45])"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Shape bottom row\n",
"arr_2d[2,:]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## More Indexing Help\n",
"Indexing a 2D matrix can be a bit confusing at first, especially when you start to add in step size. Try google image searching *NumPy indexing* to find useful images, like this one:\n",
"\n",
"<img src= 'numpy_indexing.png' width=500/> Image source: http://www.scipy-lectures.org/intro/numpy/numpy.html"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Conditional Selection\n",
"\n",
"This is a very fundamental concept that will directly translate to pandas later on, make sure you understand this part!\n",
"\n",
"Let's briefly go over how to use brackets for selection based off of comparison operators."
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr = np.arange(1,11)\n",
"arr"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([False, False, False, False, True, True, True, True, True,\n",
" True])"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr > 4"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"bool_arr = arr>4"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([False, False, False, False, True, True, True, True, True,\n",
" True])"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool_arr"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 5, 6, 7, 8, 9, 10])"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr[bool_arr]"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 3, 4, 5, 6, 7, 8, 9, 10])"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr[arr>2]"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 3, 4, 5, 6, 7, 8, 9, 10])"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = 2\n",
"arr[arr>x]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Great Job!\n"
]
}
],
"metadata": {
"anaconda-cloud": {},
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

@ -0,0 +1,539 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright Pierian Data</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"# NumPy Operations"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Arithmetic\n",
"\n",
"You can easily perform *array with array* arithmetic, or *scalar with array* arithmetic. Let's see some examples:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"arr = np.arange(0,10)\n",
"arr"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18])"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr + arr"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81])"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr * arr"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr - arr"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Anaconda3\\envs\\tsa_course\\lib\\site-packages\\ipykernel_launcher.py:3: RuntimeWarning: invalid value encountered in true_divide\n",
" This is separate from the ipykernel package so we can avoid doing imports until\n"
]
},
{
"data": {
"text/plain": [
"array([nan, 1., 1., 1., 1., 1., 1., 1., 1., 1.])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# This will raise a Warning on division by zero, but not an error!\n",
"# It just fills the spot with nan\n",
"arr/arr"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Anaconda3\\envs\\tsa_course\\lib\\site-packages\\ipykernel_launcher.py:2: RuntimeWarning: divide by zero encountered in true_divide\n",
" \n"
]
},
{
"data": {
"text/plain": [
"array([ inf, 1. , 0.5 , 0.33333333, 0.25 ,\n",
" 0.2 , 0.16666667, 0.14285714, 0.125 , 0.11111111])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Also a warning (but not an error) relating to infinity\n",
"1/arr"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 1, 8, 27, 64, 125, 216, 343, 512, 729], dtype=int32)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr**3"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Universal Array Functions\n",
"\n",
"NumPy comes with many [universal array functions](http://docs.scipy.org/doc/numpy/reference/ufuncs.html), or <em>ufuncs</em>, which are essentially just mathematical operations that can be applied across the array.<br>Let's show some common ones:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0. , 1. , 1.41421356, 1.73205081, 2. ,\n",
" 2.23606798, 2.44948974, 2.64575131, 2.82842712, 3. ])"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Taking Square Roots\n",
"np.sqrt(arr)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1.00000000e+00, 2.71828183e+00, 7.38905610e+00, 2.00855369e+01,\n",
" 5.45981500e+01, 1.48413159e+02, 4.03428793e+02, 1.09663316e+03,\n",
" 2.98095799e+03, 8.10308393e+03])"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Calculating exponential (e^)\n",
"np.exp(arr)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0. , 0.84147098, 0.90929743, 0.14112001, -0.7568025 ,\n",
" -0.95892427, -0.2794155 , 0.6569866 , 0.98935825, 0.41211849])"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Trigonometric Functions like sine\n",
"np.sin(arr)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Anaconda3\\envs\\tsa_course\\lib\\site-packages\\ipykernel_launcher.py:2: RuntimeWarning: divide by zero encountered in log\n",
" \n"
]
},
{
"data": {
"text/plain": [
"array([ -inf, 0. , 0.69314718, 1.09861229, 1.38629436,\n",
" 1.60943791, 1.79175947, 1.94591015, 2.07944154, 2.19722458])"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Taking the Natural Logarithm\n",
"np.log(arr)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Summary Statistics on Arrays\n",
"\n",
"NumPy also offers common summary statistics like <em>sum</em>, <em>mean</em> and <em>max</em>. You would call these as methods on an array."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr = np.arange(0,10)\n",
"arr"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"45"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr.sum()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4.5"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr.mean()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"9"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr.max()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<strong>Other summary statistics include:</strong>\n",
"<pre>\n",
"arr.min() returns 0 minimum\n",
"arr.var() returns 8.25 variance\n",
"arr.std() returns 2.8722813232690143 standard deviation\n",
"</pre>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Axis Logic\n",
"When working with 2-dimensional arrays (matrices) we have to consider rows and columns. This becomes very important when we get to the section on pandas. In array terms, axis 0 (zero) is the vertical axis (rows), and axis 1 is the horizonal axis (columns). These values (0,1) correspond to the order in which <tt>arr.shape</tt> values are returned.\n",
"\n",
"Let's see how this affects our summary statistic calculations from above."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 1, 2, 3, 4],\n",
" [ 5, 6, 7, 8],\n",
" [ 9, 10, 11, 12]])"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr_2d = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]])\n",
"arr_2d"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([15, 18, 21, 24])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr_2d.sum(axis=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By passing in <tt>axis=0</tt>, we're returning an array of sums along the vertical axis, essentially <tt>[(1+5+9), (2+6+10), (3+7+11), (4+8+12)]</tt>\n",
"\n",
"<img src='axis_logic.png' width=400/>"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(3, 4)"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr_2d.shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This tells us that <tt>arr_2d</tt> has 3 rows and 4 columns.\n",
"\n",
"In <tt>arr_2d.sum(axis=0)</tt> above, the first element in each row was summed, then the second element, and so forth.\n",
"\n",
"So what should <tt>arr_2d.sum(axis=1)</tt> return?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# THINK ABOUT WHAT THIS WILL RETURN BEFORE RUNNING THE CELL!\n",
"arr_2d.sum(axis=1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Great Job!\n",
"\n",
"That's all we need to know for now!"
]
}
],
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

@ -0,0 +1,850 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright Pierian Data</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# NumPy Exercises\n",
"\n",
"Now that we've learned about NumPy let's test your knowledge. We'll start off with a few simple tasks and then you'll be asked some more complicated questions.\n",
"\n",
"<div class=\"alert alert-danger\" style=\"margin: 10px\"><strong>IMPORTANT NOTE!</strong> Make sure you don't run the cells directly above the example output shown, <br>otherwise you will end up writing over the example output!</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 1. Import NumPy as np"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 2. Create an array of 10 zeros "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# CODE HERE\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 3. Create an array of 10 ones"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 4. Create an array of 10 fives"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([5., 5., 5., 5., 5., 5., 5., 5., 5., 5.])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 5. Create an array of the integers from 10 to 50"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,\n",
" 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,\n",
" 44, 45, 46, 47, 48, 49, 50])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 6. Create an array of all the even integers from 10 to 50"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42,\n",
" 44, 46, 48, 50])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 7. Create a 3x3 matrix with values ranging from 0 to 8"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0, 1, 2],\n",
" [3, 4, 5],\n",
" [6, 7, 8]])"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 8. Create a 3x3 identity matrix"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1., 0., 0.],\n",
" [0., 1., 0.],\n",
" [0., 0., 1.]])"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 9. Use NumPy to generate a random number between 0 and 1<br><br>&emsp;NOTE: Your result's value should be different from the one shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0.65248055])"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 10. Use NumPy to generate an array of 25 random numbers sampled from a standard normal distribution<br><br>&emsp;&ensp;NOTE: Your result's values should be different from the ones shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 1.80076712, -1.12375847, -0.98524305, 0.11673573, 1.96346762,\n",
" 1.81378592, -0.33790771, 0.85012656, 0.0100703 , -0.91005957,\n",
" 0.29064366, 0.69906357, 0.1774377 , -0.61958694, -0.45498611,\n",
" -2.0804685 , -0.06778549, 1.06403819, 0.4311884 , -1.09853837,\n",
" 1.11980469, -0.48751963, 1.32517611, -0.61775122, -0.00622865])"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 11. Create the following matrix:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1 ],\n",
" [0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2 ],\n",
" [0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3 ],\n",
" [0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4 ],\n",
" [0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5 ],\n",
" [0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6 ],\n",
" [0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.7 ],\n",
" [0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.8 ],\n",
" [0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9 ],\n",
" [0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1. ]])"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 12. Create an array of 20 linearly spaced points between 0 and 1:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0. , 0.05263158, 0.10526316, 0.15789474, 0.21052632,\n",
" 0.26315789, 0.31578947, 0.36842105, 0.42105263, 0.47368421,\n",
" 0.52631579, 0.57894737, 0.63157895, 0.68421053, 0.73684211,\n",
" 0.78947368, 0.84210526, 0.89473684, 0.94736842, 1. ])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Numpy Indexing and Selection\n",
"\n",
"Now you will be given a starting matrix (be sure to run the cell below!), and be asked to replicate the resulting matrix outputs:"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 1, 2, 3, 4, 5],\n",
" [ 6, 7, 8, 9, 10],\n",
" [11, 12, 13, 14, 15],\n",
" [16, 17, 18, 19, 20],\n",
" [21, 22, 23, 24, 25]])"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# RUN THIS CELL - THIS IS OUR STARTING MATRIX\n",
"mat = np.arange(1,26).reshape(5,5)\n",
"mat"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 13. Write code that reproduces the output shown below.<br><br>&emsp;&ensp;Be careful not to run the cell immediately above the output, otherwise you won't be able to see the output any more."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# CODE HERE\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[12, 13, 14, 15],\n",
" [17, 18, 19, 20],\n",
" [22, 23, 24, 25]])"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 14. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 15. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 2],\n",
" [ 7],\n",
" [12]])"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 16. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([21, 22, 23, 24, 25])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 17. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[16, 17, 18, 19, 20],\n",
" [21, 22, 23, 24, 25]])"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## NumPy Operations"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 18. Get the sum of all the values in mat"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"325"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 19. Get the standard deviation of the values in mat"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7.211102550927978"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 20. Get the sum of all the columns in mat"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([55, 60, 65, 70, 75])"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Bonus Question\n",
"\n",
"We worked a lot with random data with numpy, but is there a way we can insure that we always get the same random numbers? [Click Here for a Hint](https://www.google.com/search?q=numpy+random+seed&rlz=1C1CHBF_enUS747US747&oq=numpy+random+seed&aqs=chrome..69i57j69i60j0l4.2087j0j7&sourceid=chrome&ie=UTF-8)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"# Great Job!"
]
}
],
"metadata": {
"anaconda-cloud": {},
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

@ -0,0 +1,873 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright Pierian Data</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# NumPy Exercises - Solutions\n",
"\n",
"Now that we've learned about NumPy let's test your knowledge. We'll start off with a few simple tasks and then you'll be asked some more complicated questions.\n",
"\n",
"<div class=\"alert alert-danger\" style=\"margin: 10px\"><strong>IMPORTANT NOTE!</strong> Make sure you don't run the cells directly above the example output shown, <br>otherwise you will end up writing over the example output!</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 1. Import NumPy as np"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 2. Create an array of 10 zeros "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# CODE HERE\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.zeros(10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 3. Create an array of 10 ones"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.ones(10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 4. Create an array of 10 fives"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([5., 5., 5., 5., 5., 5., 5., 5., 5., 5.])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.ones(10) * 5"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 5. Create an array of the integers from 10 to 50"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,\n",
" 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,\n",
" 44, 45, 46, 47, 48, 49, 50])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.arange(10,51)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 6. Create an array of all the even integers from 10 to 50"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42,\n",
" 44, 46, 48, 50])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.arange(10,51,2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 7. Create a 3x3 matrix with values ranging from 0 to 8"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0, 1, 2],\n",
" [3, 4, 5],\n",
" [6, 7, 8]])"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.arange(9).reshape(3,3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 8. Create a 3x3 identity matrix"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1., 0., 0.],\n",
" [0., 1., 0.],\n",
" [0., 0., 1.]])"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.eye(3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 9. Use NumPy to generate a random number between 0 and 1<br><br>&emsp;NOTE: Your result's value should be different from the one shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0.65248055])"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.random.rand(1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 10. Use NumPy to generate an array of 25 random numbers sampled from a standard normal distribution<br><br>&emsp;&ensp;NOTE: Your result's values should be different from the ones shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 1.80076712, -1.12375847, -0.98524305, 0.11673573, 1.96346762,\n",
" 1.81378592, -0.33790771, 0.85012656, 0.0100703 , -0.91005957,\n",
" 0.29064366, 0.69906357, 0.1774377 , -0.61958694, -0.45498611,\n",
" -2.0804685 , -0.06778549, 1.06403819, 0.4311884 , -1.09853837,\n",
" 1.11980469, -0.48751963, 1.32517611, -0.61775122, -0.00622865])"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.random.randn(25)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 11. Create the following matrix:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1 ],\n",
" [0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2 ],\n",
" [0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3 ],\n",
" [0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4 ],\n",
" [0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5 ],\n",
" [0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6 ],\n",
" [0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.7 ],\n",
" [0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.8 ],\n",
" [0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9 ],\n",
" [0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1. ]])"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.arange(1,101).reshape(10,10) / 100"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 12. Create an array of 20 linearly spaced points between 0 and 1:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0. , 0.05263158, 0.10526316, 0.15789474, 0.21052632,\n",
" 0.26315789, 0.31578947, 0.36842105, 0.42105263, 0.47368421,\n",
" 0.52631579, 0.57894737, 0.63157895, 0.68421053, 0.73684211,\n",
" 0.78947368, 0.84210526, 0.89473684, 0.94736842, 1. ])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"np.linspace(0,1,20)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Numpy Indexing and Selection\n",
"\n",
"Now you will be given a starting matrix (be sure to run the cell below!), and be asked to replicate the resulting matrix outputs:"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 1, 2, 3, 4, 5],\n",
" [ 6, 7, 8, 9, 10],\n",
" [11, 12, 13, 14, 15],\n",
" [16, 17, 18, 19, 20],\n",
" [21, 22, 23, 24, 25]])"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# RUN THIS CELL - THIS IS OUR STARTING MATRIX\n",
"mat = np.arange(1,26).reshape(5,5)\n",
"mat"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 13. Write code that reproduces the output shown below.<br><br>&emsp;&ensp;Be careful not to run the cell immediately above the output, otherwise you won't be able to see the output any more."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# CODE HERE\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[12, 13, 14, 15],\n",
" [17, 18, 19, 20],\n",
" [22, 23, 24, 25]])"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"mat[2:,1:]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 14. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"mat[3,4]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 15. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 2],\n",
" [ 7],\n",
" [12]])"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"mat[:3,1:2]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 16. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([21, 22, 23, 24, 25])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"mat[4,:]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 17. Write code that reproduces the output shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[16, 17, 18, 19, 20],\n",
" [21, 22, 23, 24, 25]])"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"mat[3:5,:]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## NumPy Operations"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 18. Get the sum of all the values in mat"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"325"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"mat.sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 19. Get the standard deviation of the values in mat"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7.211102550927978"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"mat.std()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 20. Get the sum of all the columns in mat"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([55, 60, 65, 70, 75])"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# DON'T WRITE HERE\n",
"mat.sum(axis=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Bonus Question\n",
"\n",
"We worked a lot with random data with numpy, but is there a way we can insure that we always get the same random numbers? [Click Here for a Hint](https://www.google.com/search?q=numpy+random+seed&rlz=1C1CHBF_enUS747US747&oq=numpy+random+seed&aqs=chrome..69i57j69i60j0l4.2087j0j7&sourceid=chrome&ie=UTF-8)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"np.random.seed(101)"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"# Great Job!"
]
}
],
"metadata": {
"anaconda-cloud": {},
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,692 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright Pierian Data</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Time Shifting\n",
"\n",
"Sometimes you may need to shift all your data up or down along the time series index. In fact, a lot of pandas built-in methods do this under the hood. This isn't something we'll do often in the course, but it's definitely good to know about this anyways!"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"df = pd.read_csv('../Data/starbucks.csv',index_col='Date',parse_dates=True)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Close</th>\n",
" <th>Volume</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Date</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2015-01-02</th>\n",
" <td>38.0061</td>\n",
" <td>6906098</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-05</th>\n",
" <td>37.2781</td>\n",
" <td>11623796</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-06</th>\n",
" <td>36.9748</td>\n",
" <td>7664340</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-07</th>\n",
" <td>37.8848</td>\n",
" <td>9732554</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-08</th>\n",
" <td>38.4961</td>\n",
" <td>13170548</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Close Volume\n",
"Date \n",
"2015-01-02 38.0061 6906098\n",
"2015-01-05 37.2781 11623796\n",
"2015-01-06 36.9748 7664340\n",
"2015-01-07 37.8848 9732554\n",
"2015-01-08 38.4961 13170548"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Close</th>\n",
" <th>Volume</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Date</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2018-12-24</th>\n",
" <td>60.56</td>\n",
" <td>6323252</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-26</th>\n",
" <td>63.08</td>\n",
" <td>16646238</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-27</th>\n",
" <td>63.20</td>\n",
" <td>11308081</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-28</th>\n",
" <td>63.39</td>\n",
" <td>7712127</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-31</th>\n",
" <td>64.40</td>\n",
" <td>7690183</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Close Volume\n",
"Date \n",
"2018-12-24 60.56 6323252\n",
"2018-12-26 63.08 16646238\n",
"2018-12-27 63.20 11308081\n",
"2018-12-28 63.39 7712127\n",
"2018-12-31 64.40 7690183"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.tail()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## .shift() forward\n",
"This method shifts the entire date index a given number of rows, without regard for time periods (months & years).<br>It returns a modified copy of the original DataFrame."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Close</th>\n",
" <th>Volume</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Date</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2015-01-02</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-05</th>\n",
" <td>38.0061</td>\n",
" <td>6906098.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-06</th>\n",
" <td>37.2781</td>\n",
" <td>11623796.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-07</th>\n",
" <td>36.9748</td>\n",
" <td>7664340.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-08</th>\n",
" <td>37.8848</td>\n",
" <td>9732554.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Close Volume\n",
"Date \n",
"2015-01-02 NaN NaN\n",
"2015-01-05 38.0061 6906098.0\n",
"2015-01-06 37.2781 11623796.0\n",
"2015-01-07 36.9748 7664340.0\n",
"2015-01-08 37.8848 9732554.0"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.shift(1).head()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Close</th>\n",
" <th>Volume</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Date</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2018-12-24</th>\n",
" <td>61.39</td>\n",
" <td>23524888.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-26</th>\n",
" <td>60.56</td>\n",
" <td>6323252.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-27</th>\n",
" <td>63.08</td>\n",
" <td>16646238.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-28</th>\n",
" <td>63.20</td>\n",
" <td>11308081.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-31</th>\n",
" <td>63.39</td>\n",
" <td>7712127.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Close Volume\n",
"Date \n",
"2018-12-24 61.39 23524888.0\n",
"2018-12-26 60.56 6323252.0\n",
"2018-12-27 63.08 16646238.0\n",
"2018-12-28 63.20 11308081.0\n",
"2018-12-31 63.39 7712127.0"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# NOTE: You will lose that last piece of data that no longer has an index!\n",
"df.shift(1).tail()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## .shift() backwards"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Close</th>\n",
" <th>Volume</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Date</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2015-01-02</th>\n",
" <td>37.2781</td>\n",
" <td>11623796.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-05</th>\n",
" <td>36.9748</td>\n",
" <td>7664340.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-06</th>\n",
" <td>37.8848</td>\n",
" <td>9732554.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-07</th>\n",
" <td>38.4961</td>\n",
" <td>13170548.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-08</th>\n",
" <td>37.2361</td>\n",
" <td>27556706.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Close Volume\n",
"Date \n",
"2015-01-02 37.2781 11623796.0\n",
"2015-01-05 36.9748 7664340.0\n",
"2015-01-06 37.8848 9732554.0\n",
"2015-01-07 38.4961 13170548.0\n",
"2015-01-08 37.2361 27556706.0"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.shift(-1).head()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Close</th>\n",
" <th>Volume</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Date</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2018-12-24</th>\n",
" <td>63.08</td>\n",
" <td>16646238.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-26</th>\n",
" <td>63.20</td>\n",
" <td>11308081.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-27</th>\n",
" <td>63.39</td>\n",
" <td>7712127.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-28</th>\n",
" <td>64.40</td>\n",
" <td>7690183.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-12-31</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Close Volume\n",
"Date \n",
"2018-12-24 63.08 16646238.0\n",
"2018-12-26 63.20 11308081.0\n",
"2018-12-27 63.39 7712127.0\n",
"2018-12-28 64.40 7690183.0\n",
"2018-12-31 NaN NaN"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.shift(-1).tail()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Shifting based on Time Series Frequency Code\n",
"\n",
"We can choose to shift <em>index values</em> up or down without realigning the data by passing in a <strong>freq</strong> argument.<br>\n",
"This method shifts dates to the next period based on a frequency code. Common codes are 'M' for month-end and 'A' for year-end. <br>Refer to the <em>Time Series Offset Aliases</em> table from the Time Resampling lecture for a full list of values, or click <a href='http://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases'>here</a>.<br>"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Close</th>\n",
" <th>Volume</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Date</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2015-01-31</th>\n",
" <td>38.0061</td>\n",
" <td>6906098</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-31</th>\n",
" <td>37.2781</td>\n",
" <td>11623796</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-31</th>\n",
" <td>36.9748</td>\n",
" <td>7664340</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-31</th>\n",
" <td>37.8848</td>\n",
" <td>9732554</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2015-01-31</th>\n",
" <td>38.4961</td>\n",
" <td>13170548</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Close Volume\n",
"Date \n",
"2015-01-31 38.0061 6906098\n",
"2015-01-31 37.2781 11623796\n",
"2015-01-31 36.9748 7664340\n",
"2015-01-31 37.8848 9732554\n",
"2015-01-31 38.4961 13170548"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Shift everything forward one month\n",
"df.shift(periods=1, freq='M').head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For more info on time shifting visit http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.shift.html<br>\n",
"Up next we'll look at rolling and expanding!"
]
}
],
"metadata": {
"anaconda-cloud": {},
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,924 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright by Pierian Data Inc.</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Text Methods"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"A normal Python string has a variety of method calls available:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"mystring = 'hello'"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Hello'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mystring.capitalize()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mystring.isdigit()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Help on class str in module builtins:\n",
"\n",
"class str(object)\n",
" | str(object='') -> str\n",
" | str(bytes_or_buffer[, encoding[, errors]]) -> str\n",
" | \n",
" | Create a new string object from the given object. If encoding or\n",
" | errors is specified, then the object must expose a data buffer\n",
" | that will be decoded using the given encoding and error handler.\n",
" | Otherwise, returns the result of object.__str__() (if defined)\n",
" | or repr(object).\n",
" | encoding defaults to sys.getdefaultencoding().\n",
" | errors defaults to 'strict'.\n",
" | \n",
" | Methods defined here:\n",
" | \n",
" | __add__(self, value, /)\n",
" | Return self+value.\n",
" | \n",
" | __contains__(self, key, /)\n",
" | Return key in self.\n",
" | \n",
" | __eq__(self, value, /)\n",
" | Return self==value.\n",
" | \n",
" | __format__(self, format_spec, /)\n",
" | Return a formatted version of the string as described by format_spec.\n",
" | \n",
" | __ge__(self, value, /)\n",
" | Return self>=value.\n",
" | \n",
" | __getattribute__(self, name, /)\n",
" | Return getattr(self, name).\n",
" | \n",
" | __getitem__(self, key, /)\n",
" | Return self[key].\n",
" | \n",
" | __getnewargs__(...)\n",
" | \n",
" | __gt__(self, value, /)\n",
" | Return self>value.\n",
" | \n",
" | __hash__(self, /)\n",
" | Return hash(self).\n",
" | \n",
" | __iter__(self, /)\n",
" | Implement iter(self).\n",
" | \n",
" | __le__(self, value, /)\n",
" | Return self<=value.\n",
" | \n",
" | __len__(self, /)\n",
" | Return len(self).\n",
" | \n",
" | __lt__(self, value, /)\n",
" | Return self<value.\n",
" | \n",
" | __mod__(self, value, /)\n",
" | Return self%value.\n",
" | \n",
" | __mul__(self, value, /)\n",
" | Return self*value.\n",
" | \n",
" | __ne__(self, value, /)\n",
" | Return self!=value.\n",
" | \n",
" | __repr__(self, /)\n",
" | Return repr(self).\n",
" | \n",
" | __rmod__(self, value, /)\n",
" | Return value%self.\n",
" | \n",
" | __rmul__(self, value, /)\n",
" | Return value*self.\n",
" | \n",
" | __sizeof__(self, /)\n",
" | Return the size of the string in memory, in bytes.\n",
" | \n",
" | __str__(self, /)\n",
" | Return str(self).\n",
" | \n",
" | capitalize(self, /)\n",
" | Return a capitalized version of the string.\n",
" | \n",
" | More specifically, make the first character have upper case and the rest lower\n",
" | case.\n",
" | \n",
" | casefold(self, /)\n",
" | Return a version of the string suitable for caseless comparisons.\n",
" | \n",
" | center(self, width, fillchar=' ', /)\n",
" | Return a centered string of length width.\n",
" | \n",
" | Padding is done using the specified fill character (default is a space).\n",
" | \n",
" | count(...)\n",
" | S.count(sub[, start[, end]]) -> int\n",
" | \n",
" | Return the number of non-overlapping occurrences of substring sub in\n",
" | string S[start:end]. Optional arguments start and end are\n",
" | interpreted as in slice notation.\n",
" | \n",
" | encode(self, /, encoding='utf-8', errors='strict')\n",
" | Encode the string using the codec registered for encoding.\n",
" | \n",
" | encoding\n",
" | The encoding in which to encode the string.\n",
" | errors\n",
" | The error handling scheme to use for encoding errors.\n",
" | The default is 'strict' meaning that encoding errors raise a\n",
" | UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n",
" | 'xmlcharrefreplace' as well as any other name registered with\n",
" | codecs.register_error that can handle UnicodeEncodeErrors.\n",
" | \n",
" | endswith(...)\n",
" | S.endswith(suffix[, start[, end]]) -> bool\n",
" | \n",
" | Return True if S ends with the specified suffix, False otherwise.\n",
" | With optional start, test S beginning at that position.\n",
" | With optional end, stop comparing S at that position.\n",
" | suffix can also be a tuple of strings to try.\n",
" | \n",
" | expandtabs(self, /, tabsize=8)\n",
" | Return a copy where all tab characters are expanded using spaces.\n",
" | \n",
" | If tabsize is not given, a tab size of 8 characters is assumed.\n",
" | \n",
" | find(...)\n",
" | S.find(sub[, start[, end]]) -> int\n",
" | \n",
" | Return the lowest index in S where substring sub is found,\n",
" | such that sub is contained within S[start:end]. Optional\n",
" | arguments start and end are interpreted as in slice notation.\n",
" | \n",
" | Return -1 on failure.\n",
" | \n",
" | format(...)\n",
" | S.format(*args, **kwargs) -> str\n",
" | \n",
" | Return a formatted version of S, using substitutions from args and kwargs.\n",
" | The substitutions are identified by braces ('{' and '}').\n",
" | \n",
" | format_map(...)\n",
" | S.format_map(mapping) -> str\n",
" | \n",
" | Return a formatted version of S, using substitutions from mapping.\n",
" | The substitutions are identified by braces ('{' and '}').\n",
" | \n",
" | index(...)\n",
" | S.index(sub[, start[, end]]) -> int\n",
" | \n",
" | Return the lowest index in S where substring sub is found, \n",
" | such that sub is contained within S[start:end]. Optional\n",
" | arguments start and end are interpreted as in slice notation.\n",
" | \n",
" | Raises ValueError when the substring is not found.\n",
" | \n",
" | isalnum(self, /)\n",
" | Return True if the string is an alpha-numeric string, False otherwise.\n",
" | \n",
" | A string is alpha-numeric if all characters in the string are alpha-numeric and\n",
" | there is at least one character in the string.\n",
" | \n",
" | isalpha(self, /)\n",
" | Return True if the string is an alphabetic string, False otherwise.\n",
" | \n",
" | A string is alphabetic if all characters in the string are alphabetic and there\n",
" | is at least one character in the string.\n",
" | \n",
" | isascii(self, /)\n",
" | Return True if all characters in the string are ASCII, False otherwise.\n",
" | \n",
" | ASCII characters have code points in the range U+0000-U+007F.\n",
" | Empty string is ASCII too.\n",
" | \n",
" | isdecimal(self, /)\n",
" | Return True if the string is a decimal string, False otherwise.\n",
" | \n",
" | A string is a decimal string if all characters in the string are decimal and\n",
" | there is at least one character in the string.\n",
" | \n",
" | isdigit(self, /)\n",
" | Return True if the string is a digit string, False otherwise.\n",
" | \n",
" | A string is a digit string if all characters in the string are digits and there\n",
" | is at least one character in the string.\n",
" | \n",
" | isidentifier(self, /)\n",
" | Return True if the string is a valid Python identifier, False otherwise.\n",
" | \n",
" | Use keyword.iskeyword() to test for reserved identifiers such as \"def\" and\n",
" | \"class\".\n",
" | \n",
" | islower(self, /)\n",
" | Return True if the string is a lowercase string, False otherwise.\n",
" | \n",
" | A string is lowercase if all cased characters in the string are lowercase and\n",
" | there is at least one cased character in the string.\n",
" | \n",
" | isnumeric(self, /)\n",
" | Return True if the string is a numeric string, False otherwise.\n",
" | \n",
" | A string is numeric if all characters in the string are numeric and there is at\n",
" | least one character in the string.\n",
" | \n",
" | isprintable(self, /)\n",
" | Return True if the string is printable, False otherwise.\n",
" | \n",
" | A string is printable if all of its characters are considered printable in\n",
" | repr() or if it is empty.\n",
" | \n",
" | isspace(self, /)\n",
" | Return True if the string is a whitespace string, False otherwise.\n",
" | \n",
" | A string is whitespace if all characters in the string are whitespace and there\n",
" | is at least one character in the string.\n",
" | \n",
" | istitle(self, /)\n",
" | Return True if the string is a title-cased string, False otherwise.\n",
" | \n",
" | In a title-cased string, upper- and title-case characters may only\n",
" | follow uncased characters and lowercase characters only cased ones.\n",
" | \n",
" | isupper(self, /)\n",
" | Return True if the string is an uppercase string, False otherwise.\n",
" | \n",
" | A string is uppercase if all cased characters in the string are uppercase and\n",
" | there is at least one cased character in the string.\n",
" | \n",
" | join(self, iterable, /)\n",
" | Concatenate any number of strings.\n",
" | \n",
" | The string whose method is called is inserted in between each given string.\n",
" | The result is returned as a new string.\n",
" | \n",
" | Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'\n",
" | \n",
" | ljust(self, width, fillchar=' ', /)\n",
" | Return a left-justified string of length width.\n",
" | \n",
" | Padding is done using the specified fill character (default is a space).\n",
" | \n",
" | lower(self, /)\n",
" | Return a copy of the string converted to lowercase.\n",
" | \n",
" | lstrip(self, chars=None, /)\n",
" | Return a copy of the string with leading whitespace removed.\n",
" | \n",
" | If chars is given and not None, remove characters in chars instead.\n",
" | \n",
" | partition(self, sep, /)\n",
" | Partition the string into three parts using the given separator.\n",
" | \n",
" | This will search for the separator in the string. If the separator is found,\n",
" | returns a 3-tuple containing the part before the separator, the separator\n",
" | itself, and the part after it.\n",
" | \n",
" | If the separator is not found, returns a 3-tuple containing the original string\n",
" | and two empty strings.\n",
" | \n",
" | replace(self, old, new, count=-1, /)\n",
" | Return a copy with all occurrences of substring old replaced by new.\n",
" | \n",
" | count\n",
" | Maximum number of occurrences to replace.\n",
" | -1 (the default value) means replace all occurrences.\n",
" | \n",
" | If the optional argument count is given, only the first count occurrences are\n",
" | replaced.\n",
" | \n",
" | rfind(...)\n",
" | S.rfind(sub[, start[, end]]) -> int\n",
" | \n",
" | Return the highest index in S where substring sub is found,\n",
" | such that sub is contained within S[start:end]. Optional\n",
" | arguments start and end are interpreted as in slice notation.\n",
" | \n",
" | Return -1 on failure.\n",
" | \n",
" | rindex(...)\n",
" | S.rindex(sub[, start[, end]]) -> int\n",
" | \n",
" | Return the highest index in S where substring sub is found,\n",
" | such that sub is contained within S[start:end]. Optional\n",
" | arguments start and end are interpreted as in slice notation.\n",
" | \n",
" | Raises ValueError when the substring is not found.\n",
" | \n",
" | rjust(self, width, fillchar=' ', /)\n",
" | Return a right-justified string of length width.\n",
" | \n",
" | Padding is done using the specified fill character (default is a space).\n",
" | \n",
" | rpartition(self, sep, /)\n",
" | Partition the string into three parts using the given separator.\n",
" | \n",
" | This will search for the separator in the string, starting at the end. If\n",
" | the separator is found, returns a 3-tuple containing the part before the\n",
" | separator, the separator itself, and the part after it.\n",
" | \n",
" | If the separator is not found, returns a 3-tuple containing two empty strings\n",
" | and the original string.\n",
" | \n",
" | rsplit(self, /, sep=None, maxsplit=-1)\n",
" | Return a list of the words in the string, using sep as the delimiter string.\n",
" | \n",
" | sep\n",
" | The delimiter according which to split the string.\n",
" | None (the default value) means split according to any whitespace,\n",
" | and discard empty strings from the result.\n",
" | maxsplit\n",
" | Maximum number of splits to do.\n",
" | -1 (the default value) means no limit.\n",
" | \n",
" | Splits are done starting at the end of the string and working to the front.\n",
" | \n",
" | rstrip(self, chars=None, /)\n",
" | Return a copy of the string with trailing whitespace removed.\n",
" | \n",
" | If chars is given and not None, remove characters in chars instead.\n",
" | \n",
" | split(self, /, sep=None, maxsplit=-1)\n",
" | Return a list of the words in the string, using sep as the delimiter string.\n",
" | \n",
" | sep\n",
" | The delimiter according which to split the string.\n",
" | None (the default value) means split according to any whitespace,\n",
" | and discard empty strings from the result.\n",
" | maxsplit\n",
" | Maximum number of splits to do.\n",
" | -1 (the default value) means no limit.\n",
" | \n",
" | splitlines(self, /, keepends=False)\n",
" | Return a list of the lines in the string, breaking at line boundaries.\n",
" | \n",
" | Line breaks are not included in the resulting list unless keepends is given and\n",
" | true.\n",
" | \n",
" | startswith(...)\n",
" | S.startswith(prefix[, start[, end]]) -> bool\n",
" | \n",
" | Return True if S starts with the specified prefix, False otherwise.\n",
" | With optional start, test S beginning at that position.\n",
" | With optional end, stop comparing S at that position.\n",
" | prefix can also be a tuple of strings to try.\n",
" | \n",
" | strip(self, chars=None, /)\n",
" | Return a copy of the string with leading and trailing whitespace removed.\n",
" | \n",
" | If chars is given and not None, remove characters in chars instead.\n",
" | \n",
" | swapcase(self, /)\n",
" | Convert uppercase characters to lowercase and lowercase characters to uppercase.\n",
" | \n",
" | title(self, /)\n",
" | Return a version of the string where each word is titlecased.\n",
" | \n",
" | More specifically, words start with uppercased characters and all remaining\n",
" | cased characters have lower case.\n",
" | \n",
" | translate(self, table, /)\n",
" | Replace each character in the string using the given translation table.\n",
" | \n",
" | table\n",
" | Translation table, which must be a mapping of Unicode ordinals to\n",
" | Unicode ordinals, strings, or None.\n",
" | \n",
" | The table must implement lookup/indexing via __getitem__, for instance a\n",
" | dictionary or list. If this operation raises LookupError, the character is\n",
" | left untouched. Characters mapped to None are deleted.\n",
" | \n",
" | upper(self, /)\n",
" | Return a copy of the string converted to uppercase.\n",
" | \n",
" | zfill(self, width, /)\n",
" | Pad a numeric string with zeros on the left, to fill a field of the given width.\n",
" | \n",
" | The string is never truncated.\n",
" | \n",
" | ----------------------------------------------------------------------\n",
" | Static methods defined here:\n",
" | \n",
" | __new__(*args, **kwargs) from builtins.type\n",
" | Create and return a new object. See help(type) for accurate signature.\n",
" | \n",
" | maketrans(x, y=None, z=None, /)\n",
" | Return a translation table usable for str.translate().\n",
" | \n",
" | If there is only one argument, it must be a dictionary mapping Unicode\n",
" | ordinals (integers) or characters to Unicode ordinals, strings or None.\n",
" | Character keys will be then converted to ordinals.\n",
" | If there are two arguments, they must be strings of equal length, and\n",
" | in the resulting dictionary, each character in x will be mapped to the\n",
" | character at the same position in y. If there is a third argument, it\n",
" | must be a string, whose characters will be mapped to None in the result.\n",
"\n"
]
}
],
"source": [
"help(str)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Pandas and Text\n",
"\n",
"Pandas can do a lot more than what we show here. Full online documentation on things like advanced string indexing and regular expressions with pandas can be found here: https://pandas.pydata.org/docs/user_guide/text.html\n",
"\n",
"## Text Methods on Pandas String Column"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"names = pd.Series(['andrew','bobo','claire','david','4'])"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 andrew\n",
"1 bobo\n",
"2 claire\n",
"3 david\n",
"4 4\n",
"dtype: object"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"names"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 Andrew\n",
"1 Bobo\n",
"2 Claire\n",
"3 David\n",
"4 4\n",
"dtype: object"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"names.str.capitalize()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 False\n",
"1 False\n",
"2 False\n",
"3 False\n",
"4 True\n",
"dtype: bool"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"names.str.isdigit()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"messy_names = pd.Series([\"andrew \",\"bo;bo\",\" claire \"])"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 andrew \n",
"1 bo;bo\n",
"2 claire \n",
"dtype: object"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Notice the \"mis-alignment\" on the right hand side due to spacing in \"andrew \" and \" claire \"\n",
"messy_names"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 andrew \n",
"1 bobo\n",
"2 claire \n",
"dtype: object"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"messy_names.str.replace(\";\",\"\")"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 andrew\n",
"1 bo;bo\n",
"2 claire\n",
"dtype: object"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"messy_names.str.strip()"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 andrew\n",
"1 bobo\n",
"2 claire\n",
"dtype: object"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"messy_names.str.replace(\";\",\"\").str.strip()"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 Andrew\n",
"1 Bobo\n",
"2 Claire\n",
"dtype: object"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"messy_names.str.replace(\";\",\"\").str.strip().str.capitalize()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Alternative with Custom apply() call"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
"def cleanup(name):\n",
" name = name.replace(\";\",\"\")\n",
" name = name.strip()\n",
" name = name.capitalize()\n",
" return name"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 andrew \n",
"1 bo;bo\n",
"2 claire \n",
"dtype: object"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"messy_names"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 Andrew\n",
"1 Bobo\n",
"2 Claire\n",
"dtype: object"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"messy_names.apply(cleanup)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Which one is more efficient?"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [],
"source": [
"import timeit \n",
" \n",
"# code snippet to be executed only once \n",
"setup = '''\n",
"import pandas as pd\n",
"import numpy as np\n",
"messy_names = pd.Series([\"andrew \",\"bo;bo\",\" claire \"])\n",
"def cleanup(name):\n",
" name = name.replace(\";\",\"\")\n",
" name = name.strip()\n",
" name = name.capitalize()\n",
" return name\n",
"'''\n",
" \n",
"# code snippet whose execution time is to be measured \n",
"stmt_pandas_str = ''' \n",
"messy_names.str.replace(\";\",\"\").str.strip().str.capitalize()\n",
"'''\n",
"\n",
"stmt_pandas_apply = '''\n",
"messy_names.apply(cleanup)\n",
"'''\n",
"\n",
"stmt_pandas_vectorize='''\n",
"np.vectorize(cleanup)(messy_names)\n",
"'''"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.931618999999955"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"timeit.timeit(setup = setup, \n",
" stmt = stmt_pandas_str, \n",
" number = 10000) "
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.2268500999999787"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"timeit.timeit(setup = setup, \n",
" stmt = stmt_pandas_apply, \n",
" number = 10000) "
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.28283379999993485"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"timeit.timeit(setup = setup, \n",
" stmt = stmt_pandas_vectorize, \n",
" number = 10000) "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Wow! While .str() methods can be extremely convienent, when it comes to performance, don't forget about np.vectorize()! Review the \"Useful Methods\" lecture for a deeper discussion on np.vectorize()"
]
}
],
"metadata": {
"anaconda-cloud": {},
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,717 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright Pierian Data</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Introduction to Time Series with Pandas\n",
"\n",
"Most of our data will have a datatime index, so let's learn how to deal with this sort of data with pandas!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Python Datetime Review\n",
"In the course introduction section we discussed Python datetime objects."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from datetime import datetime"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# To illustrate the order of arguments\n",
"my_year = 2017\n",
"my_month = 1\n",
"my_day = 2\n",
"my_hour = 13\n",
"my_minute = 30\n",
"my_second = 15"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# January 2nd, 2017\n",
"my_date = datetime(my_year,my_month,my_day)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.datetime(2017, 1, 2, 0, 0)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Defaults to 0:00\n",
"my_date "
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# January 2nd, 2017 at 13:30:15\n",
"my_date_time = datetime(my_year,my_month,my_day,my_hour,my_minute,my_second)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.datetime(2017, 1, 2, 13, 30, 15)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_date_time"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can grab any part of the datetime object you want"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_date.day"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"13"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_date_time.hour"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## NumPy Datetime Arrays\n",
"We mentioned that NumPy handles dates more efficiently than Python's datetime format.<br>\n",
"The NumPy data type is called <em>datetime64</em> to distinguish it from Python's datetime.\n",
"\n",
"In this section we'll show how to set up datetime arrays in NumPy. These will become useful later on in the course.<br>\n",
"For more info on NumPy visit https://docs.scipy.org/doc/numpy-1.15.4/reference/arrays.datetime.html"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array(['2016-03-15', '2017-05-24', '2018-08-09'], dtype='datetime64[D]')"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# CREATE AN ARRAY FROM THREE DATES\n",
"np.array(['2016-03-15', '2017-05-24', '2018-08-09'], dtype='datetime64')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-info\"><strong>NOTE:</strong> We see the dtype listed as <tt>'datetime64[D]'</tt>. This tells us that NumPy applied a day-level date precision.<br>\n",
" If we want we can pass in a different measurement, such as <TT>[h]</TT> for hour or <TT>[Y]</TT> for year.</div>"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array(['2016-03-15T00', '2017-05-24T00', '2018-08-09T00'],\n",
" dtype='datetime64[h]')"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.array(['2016-03-15', '2017-05-24', '2018-08-09'], dtype='datetime64[h]')"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array(['2016', '2017', '2018'], dtype='datetime64[Y]')"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.array(['2016-03-15', '2017-05-24', '2018-08-09'], dtype='datetime64[Y]')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## NumPy Date Ranges\n",
"Just as <tt>np.arange(start,stop,step)</tt> can be used to produce an array of evenly-spaced integers, we can pass a <tt>dtype</tt> argument to obtain an array of dates. Remember that the stop date is <em>exclusive</em>."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array(['2018-06-01', '2018-06-08', '2018-06-15', '2018-06-22'],\n",
" dtype='datetime64[D]')"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# AN ARRAY OF DATES FROM 6/1/18 TO 6/22/18 SPACED ONE WEEK APART\n",
"np.arange('2018-06-01', '2018-06-23', 7, dtype='datetime64[D]')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By omitting the step value we can obtain every value based on the precision."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array(['1968', '1969', '1970', '1971', '1972', '1973', '1974', '1975'],\n",
" dtype='datetime64[Y]')"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# AN ARRAY OF DATES FOR EVERY YEAR FROM 1968 TO 1975\n",
"np.arange('1968', '1976', dtype='datetime64[Y]')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Pandas Datetime Index\n",
"\n",
"We'll usually deal with time series as a datetime index when working with pandas dataframes. Fortunately pandas has a lot of functions and methods to work with time series!<br>\n",
"For more on the pandas DatetimeIndex visit https://pandas.pydata.org/pandas-docs/stable/timeseries.html"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The simplest way to build a DatetimeIndex is with the <tt><strong>pd.date_range()</strong></tt> method:"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"DatetimeIndex(['2018-07-08', '2018-07-09', '2018-07-10', '2018-07-11',\n",
" '2018-07-12', '2018-07-13', '2018-07-14'],\n",
" dtype='datetime64[ns]', freq='D')"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# THE WEEK OF JULY 8TH, 2018\n",
"idx = pd.date_range('7/8/2018', periods=7, freq='D')\n",
"idx"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-info\"><strong>DatetimeIndex Frequencies:</strong> When we used <tt>pd.date_range()</tt> above, we had to pass in a frequency parameter <tt>'D'</tt>. This created a series of 7 dates spaced one day apart. We'll cover this topic in depth in upcoming lectures, but for now, a list of time series offset aliases like <tt>'D'</tt> can be found <a href='http://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases'>here</a>.</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Another way is to convert incoming text with the <tt><strong>pd.to_datetime()</strong></tt> method:"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', 'NaT'], dtype='datetime64[ns]', freq=None)"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"idx = pd.to_datetime(['Jan 01, 2018','1/2/18','03-Jan-2018',None])\n",
"idx"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A third way is to pass a list or an array of datetime objects into the <tt><strong>pd.DatetimeIndex()</strong></tt> method:"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array(['2016-03-15', '2017-05-24', '2018-08-09'], dtype='datetime64[D]')"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Create a NumPy datetime array\n",
"some_dates = np.array(['2016-03-15', '2017-05-24', '2018-08-09'], dtype='datetime64[D]')\n",
"some_dates"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"DatetimeIndex(['2016-03-15', '2017-05-24', '2018-08-09'], dtype='datetime64[ns]', freq=None)"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Convert to an index\n",
"idx = pd.DatetimeIndex(some_dates)\n",
"idx"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notice that even though the dates came into pandas with a day-level precision, pandas assigns a nanosecond-level precision with the expectation that we might want this later on.\n",
"\n",
"To set an existing column as the index, use <tt>.set_index()</tt><br>\n",
"><tt>df.set_index('Date',inplace=True)</tt>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Pandas Datetime Analysis"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[-1.64971705 1.07943894]\n",
" [ 0.4587492 -0.04201784]\n",
" [-1.2793774 -1.85383771]]\n"
]
}
],
"source": [
"# Create some random data\n",
"data = np.random.randn(3,2)\n",
"cols = ['A','B']\n",
"print(data)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>A</th>\n",
" <th>B</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2016-03-15</th>\n",
" <td>-1.649717</td>\n",
" <td>1.079439</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2017-05-24</th>\n",
" <td>0.458749</td>\n",
" <td>-0.042018</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-08-09</th>\n",
" <td>-1.279377</td>\n",
" <td>-1.853838</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" A B\n",
"2016-03-15 -1.649717 1.079439\n",
"2017-05-24 0.458749 -0.042018\n",
"2018-08-09 -1.279377 -1.853838"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Create a DataFrame with our random data, our date index, and our columns\n",
"df = pd.DataFrame(data,idx,cols)\n",
"df"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we can perform a typical analysis of our DataFrame"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"DatetimeIndex(['2016-03-15', '2017-05-24', '2018-08-09'], dtype='datetime64[ns]', freq=None)"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.index"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Timestamp('2018-08-09 00:00:00')"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Latest Date Value\n",
"df.index.max()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Latest Date Index Location\n",
"df.index.argmax()"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Timestamp('2016-03-15 00:00:00')"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Earliest Date Value\n",
"df.index.min()"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Earliest Date Index Location\n",
"df.index.argmin()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-info\"><strong>NOTE:</strong> Normally we would find index locations by running <tt>.idxmin()</tt> or <tt>.idxmax()</tt> on <tt>df['column']</tt> since <tt>.argmin()</tt> and <tt>.argmax()</tt> have been deprecated. However, we still use <tt>.argmin()</tt> and <tt>.argmax()</tt> on the index itself.</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Great, let's move on!"
]
}
],
"metadata": {
"anaconda-cloud": {},
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,341 @@
DATE,MRTSSM4453USN
1992-01-01,1509
1992-02-01,1541
1992-03-01,1597
1992-04-01,1675
1992-05-01,1822
1992-06-01,1775
1992-07-01,1912
1992-08-01,1862
1992-09-01,1770
1992-10-01,1882
1992-11-01,1831
1992-12-01,2511
1993-01-01,1614
1993-02-01,1529
1993-03-01,1678
1993-04-01,1713
1993-05-01,1796
1993-06-01,1792
1993-07-01,1950
1993-08-01,1777
1993-09-01,1707
1993-10-01,1757
1993-11-01,1782
1993-12-01,2443
1994-01-01,1548
1994-02-01,1505
1994-03-01,1714
1994-04-01,1757
1994-05-01,1830
1994-06-01,1857
1994-07-01,1981
1994-08-01,1858
1994-09-01,1823
1994-10-01,1806
1994-11-01,1845
1994-12-01,2577
1995-01-01,1555
1995-02-01,1501
1995-03-01,1725
1995-04-01,1699
1995-05-01,1807
1995-06-01,1863
1995-07-01,1886
1995-08-01,1861
1995-09-01,1845
1995-10-01,1788
1995-11-01,1879
1995-12-01,2598
1996-01-01,1679
1996-02-01,1652
1996-03-01,1837
1996-04-01,1798
1996-05-01,1957
1996-06-01,1958
1996-07-01,2034
1996-08-01,2062
1996-09-01,1781
1996-10-01,1860
1996-11-01,1992
1996-12-01,2547
1997-01-01,1706
1997-02-01,1621
1997-03-01,1853
1997-04-01,1817
1997-05-01,2060
1997-06-01,2002
1997-07-01,2098
1997-08-01,2079
1997-09-01,1892
1997-10-01,2050
1997-11-01,2082
1997-12-01,2821
1998-01-01,1846
1998-02-01,1768
1998-03-01,1894
1998-04-01,1963
1998-05-01,2140
1998-06-01,2059
1998-07-01,2209
1998-08-01,2118
1998-09-01,2031
1998-10-01,2163
1998-11-01,2154
1998-12-01,3037
1999-01-01,1866
1999-02-01,1808
1999-03-01,1986
1999-04-01,2099
1999-05-01,2210
1999-06-01,2145
1999-07-01,2339
1999-08-01,2140
1999-09-01,2126
1999-10-01,2219
1999-11-01,2273
1999-12-01,3265
2000-01-01,1920
2000-02-01,1976
2000-03-01,2190
2000-04-01,2132
2000-05-01,2357
2000-06-01,2413
2000-07-01,2463
2000-08-01,2422
2000-09-01,2358
2000-10-01,2352
2000-11-01,2549
2000-12-01,3375
2001-01-01,2109
2001-02-01,2052
2001-03-01,2327
2001-04-01,2231
2001-05-01,2470
2001-06-01,2526
2001-07-01,2483
2001-08-01,2518
2001-09-01,2316
2001-10-01,2409
2001-11-01,2638
2001-12-01,3542
2002-01-01,2114
2002-02-01,2109
2002-03-01,2366
2002-04-01,2300
2002-05-01,2569
2002-06-01,2486
2002-07-01,2568
2002-08-01,2595
2002-09-01,2297
2002-10-01,2401
2002-11-01,2601
2002-12-01,3488
2003-01-01,2121
2003-02-01,2046
2003-03-01,2273
2003-04-01,2333
2003-05-01,2576
2003-06-01,2433
2003-07-01,2611
2003-08-01,2660
2003-09-01,2461
2003-10-01,2641
2003-11-01,2660
2003-12-01,3654
2004-01-01,2293
2004-02-01,2219
2004-03-01,2398
2004-04-01,2553
2004-05-01,2685
2004-06-01,2643
2004-07-01,2867
2004-08-01,2622
2004-09-01,2618
2004-10-01,2727
2004-11-01,2763
2004-12-01,3801
2005-01-01,2219
2005-02-01,2316
2005-03-01,2530
2005-04-01,2640
2005-05-01,2709
2005-06-01,2783
2005-07-01,2924
2005-08-01,2791
2005-09-01,2784
2005-10-01,2801
2005-11-01,2933
2005-12-01,4137
2006-01-01,2424
2006-02-01,2519
2006-03-01,2753
2006-04-01,2791
2006-05-01,3017
2006-06-01,3055
2006-07-01,3117
2006-08-01,3024
2006-09-01,2997
2006-10-01,2913
2006-11-01,3137
2006-12-01,4269
2007-01-01,2569
2007-02-01,2603
2007-03-01,3005
2007-04-01,2867
2007-05-01,3262
2007-06-01,3364
2007-07-01,3322
2007-08-01,3292
2007-09-01,3057
2007-10-01,3087
2007-11-01,3297
2007-12-01,4403
2008-01-01,2675
2008-02-01,2806
2008-03-01,2989
2008-04-01,2997
2008-05-01,3420
2008-06-01,3279
2008-07-01,3517
2008-08-01,3472
2008-09-01,3151
2008-10-01,3351
2008-11-01,3386
2008-12-01,4461
2009-01-01,2913
2009-02-01,2781
2009-03-01,3024
2009-04-01,3130
2009-05-01,3467
2009-06-01,3307
2009-07-01,3555
2009-08-01,3399
2009-09-01,3263
2009-10-01,3425
2009-11-01,3356
2009-12-01,4625
2010-01-01,2878
2010-02-01,2916
2010-03-01,3214
2010-04-01,3310
2010-05-01,3467
2010-06-01,3438
2010-07-01,3657
2010-08-01,3454
2010-09-01,3365
2010-10-01,3497
2010-11-01,3524
2010-12-01,4681
2011-01-01,2888
2011-02-01,2984
2011-03-01,3249
2011-04-01,3363
2011-05-01,3471
2011-06-01,3551
2011-07-01,3740
2011-08-01,3576
2011-09-01,3517
2011-10-01,3515
2011-11-01,3646
2011-12-01,4892
2012-01-01,2995
2012-02-01,3202
2012-03-01,3550
2012-04-01,3409
2012-05-01,3786
2012-06-01,3816
2012-07-01,3733
2012-08-01,3752
2012-09-01,3503
2012-10-01,3626
2012-11-01,3869
2012-12-01,5124
2013-01-01,3155
2013-02-01,3227
2013-03-01,3624
2013-04-01,3488
2013-05-01,3947
2013-06-01,3809
2013-07-01,4034
2013-08-01,4100
2013-09-01,3631
2013-10-01,3787
2013-11-01,4059
2013-12-01,5215
2014-01-01,3381
2014-02-01,3310
2014-03-01,3652
2014-04-01,3702
2014-05-01,4165
2014-06-01,4036
2014-07-01,4242
2014-08-01,4219
2014-09-01,3814
2014-10-01,4090
2014-11-01,4103
2014-12-01,5572
2015-01-01,3572
2015-02-01,3482
2015-03-01,3857
2015-04-01,3867
2015-05-01,4335
2015-06-01,4217
2015-07-01,4532
2015-08-01,4260
2015-09-01,4073
2015-10-01,4273
2015-11-01,4266
2015-12-01,5816
2016-01-01,3607
2016-02-01,3769
2016-03-01,4045
2016-04-01,4108
2016-05-01,4396
2016-06-01,4468
2016-07-01,4745
2016-08-01,4475
2016-09-01,4431
2016-10-01,4436
2016-11-01,4676
2016-12-01,6057
2017-01-01,3740
2017-02-01,3774
2017-03-01,4266
2017-04-01,4273
2017-05-01,4673
2017-06-01,4703
2017-07-01,4828
2017-08-01,4677
2017-09-01,4568
2017-10-01,4567
2017-11-01,4879
2017-12-01,6284
2018-01-01,3991
2018-02-01,3992
2018-03-01,4670
2018-04-01,4362
2018-05-01,4950
2018-06-01,4990
2018-07-01,5011
2018-08-01,4945
2018-09-01,4650
2018-10-01,4789
2018-11-01,5176
2018-12-01,6442
2019-01-01,4134
2019-02-01,4116
2019-03-01,4673
2019-04-01,4580
2019-05-01,5109
2019-06-01,5011
2019-07-01,5245
2019-08-01,5270
2019-09-01,4680
2019-10-01,4913
2019-11-01,5312
2019-12-01,6630
2020-01-01,4388
2020-02-01,4533
2020-03-01,5562
2020-04-01,5207
1 DATE MRTSSM4453USN
2 1992-01-01 1509
3 1992-02-01 1541
4 1992-03-01 1597
5 1992-04-01 1675
6 1992-05-01 1822
7 1992-06-01 1775
8 1992-07-01 1912
9 1992-08-01 1862
10 1992-09-01 1770
11 1992-10-01 1882
12 1992-11-01 1831
13 1992-12-01 2511
14 1993-01-01 1614
15 1993-02-01 1529
16 1993-03-01 1678
17 1993-04-01 1713
18 1993-05-01 1796
19 1993-06-01 1792
20 1993-07-01 1950
21 1993-08-01 1777
22 1993-09-01 1707
23 1993-10-01 1757
24 1993-11-01 1782
25 1993-12-01 2443
26 1994-01-01 1548
27 1994-02-01 1505
28 1994-03-01 1714
29 1994-04-01 1757
30 1994-05-01 1830
31 1994-06-01 1857
32 1994-07-01 1981
33 1994-08-01 1858
34 1994-09-01 1823
35 1994-10-01 1806
36 1994-11-01 1845
37 1994-12-01 2577
38 1995-01-01 1555
39 1995-02-01 1501
40 1995-03-01 1725
41 1995-04-01 1699
42 1995-05-01 1807
43 1995-06-01 1863
44 1995-07-01 1886
45 1995-08-01 1861
46 1995-09-01 1845
47 1995-10-01 1788
48 1995-11-01 1879
49 1995-12-01 2598
50 1996-01-01 1679
51 1996-02-01 1652
52 1996-03-01 1837
53 1996-04-01 1798
54 1996-05-01 1957
55 1996-06-01 1958
56 1996-07-01 2034
57 1996-08-01 2062
58 1996-09-01 1781
59 1996-10-01 1860
60 1996-11-01 1992
61 1996-12-01 2547
62 1997-01-01 1706
63 1997-02-01 1621
64 1997-03-01 1853
65 1997-04-01 1817
66 1997-05-01 2060
67 1997-06-01 2002
68 1997-07-01 2098
69 1997-08-01 2079
70 1997-09-01 1892
71 1997-10-01 2050
72 1997-11-01 2082
73 1997-12-01 2821
74 1998-01-01 1846
75 1998-02-01 1768
76 1998-03-01 1894
77 1998-04-01 1963
78 1998-05-01 2140
79 1998-06-01 2059
80 1998-07-01 2209
81 1998-08-01 2118
82 1998-09-01 2031
83 1998-10-01 2163
84 1998-11-01 2154
85 1998-12-01 3037
86 1999-01-01 1866
87 1999-02-01 1808
88 1999-03-01 1986
89 1999-04-01 2099
90 1999-05-01 2210
91 1999-06-01 2145
92 1999-07-01 2339
93 1999-08-01 2140
94 1999-09-01 2126
95 1999-10-01 2219
96 1999-11-01 2273
97 1999-12-01 3265
98 2000-01-01 1920
99 2000-02-01 1976
100 2000-03-01 2190
101 2000-04-01 2132
102 2000-05-01 2357
103 2000-06-01 2413
104 2000-07-01 2463
105 2000-08-01 2422
106 2000-09-01 2358
107 2000-10-01 2352
108 2000-11-01 2549
109 2000-12-01 3375
110 2001-01-01 2109
111 2001-02-01 2052
112 2001-03-01 2327
113 2001-04-01 2231
114 2001-05-01 2470
115 2001-06-01 2526
116 2001-07-01 2483
117 2001-08-01 2518
118 2001-09-01 2316
119 2001-10-01 2409
120 2001-11-01 2638
121 2001-12-01 3542
122 2002-01-01 2114
123 2002-02-01 2109
124 2002-03-01 2366
125 2002-04-01 2300
126 2002-05-01 2569
127 2002-06-01 2486
128 2002-07-01 2568
129 2002-08-01 2595
130 2002-09-01 2297
131 2002-10-01 2401
132 2002-11-01 2601
133 2002-12-01 3488
134 2003-01-01 2121
135 2003-02-01 2046
136 2003-03-01 2273
137 2003-04-01 2333
138 2003-05-01 2576
139 2003-06-01 2433
140 2003-07-01 2611
141 2003-08-01 2660
142 2003-09-01 2461
143 2003-10-01 2641
144 2003-11-01 2660
145 2003-12-01 3654
146 2004-01-01 2293
147 2004-02-01 2219
148 2004-03-01 2398
149 2004-04-01 2553
150 2004-05-01 2685
151 2004-06-01 2643
152 2004-07-01 2867
153 2004-08-01 2622
154 2004-09-01 2618
155 2004-10-01 2727
156 2004-11-01 2763
157 2004-12-01 3801
158 2005-01-01 2219
159 2005-02-01 2316
160 2005-03-01 2530
161 2005-04-01 2640
162 2005-05-01 2709
163 2005-06-01 2783
164 2005-07-01 2924
165 2005-08-01 2791
166 2005-09-01 2784
167 2005-10-01 2801
168 2005-11-01 2933
169 2005-12-01 4137
170 2006-01-01 2424
171 2006-02-01 2519
172 2006-03-01 2753
173 2006-04-01 2791
174 2006-05-01 3017
175 2006-06-01 3055
176 2006-07-01 3117
177 2006-08-01 3024
178 2006-09-01 2997
179 2006-10-01 2913
180 2006-11-01 3137
181 2006-12-01 4269
182 2007-01-01 2569
183 2007-02-01 2603
184 2007-03-01 3005
185 2007-04-01 2867
186 2007-05-01 3262
187 2007-06-01 3364
188 2007-07-01 3322
189 2007-08-01 3292
190 2007-09-01 3057
191 2007-10-01 3087
192 2007-11-01 3297
193 2007-12-01 4403
194 2008-01-01 2675
195 2008-02-01 2806
196 2008-03-01 2989
197 2008-04-01 2997
198 2008-05-01 3420
199 2008-06-01 3279
200 2008-07-01 3517
201 2008-08-01 3472
202 2008-09-01 3151
203 2008-10-01 3351
204 2008-11-01 3386
205 2008-12-01 4461
206 2009-01-01 2913
207 2009-02-01 2781
208 2009-03-01 3024
209 2009-04-01 3130
210 2009-05-01 3467
211 2009-06-01 3307
212 2009-07-01 3555
213 2009-08-01 3399
214 2009-09-01 3263
215 2009-10-01 3425
216 2009-11-01 3356
217 2009-12-01 4625
218 2010-01-01 2878
219 2010-02-01 2916
220 2010-03-01 3214
221 2010-04-01 3310
222 2010-05-01 3467
223 2010-06-01 3438
224 2010-07-01 3657
225 2010-08-01 3454
226 2010-09-01 3365
227 2010-10-01 3497
228 2010-11-01 3524
229 2010-12-01 4681
230 2011-01-01 2888
231 2011-02-01 2984
232 2011-03-01 3249
233 2011-04-01 3363
234 2011-05-01 3471
235 2011-06-01 3551
236 2011-07-01 3740
237 2011-08-01 3576
238 2011-09-01 3517
239 2011-10-01 3515
240 2011-11-01 3646
241 2011-12-01 4892
242 2012-01-01 2995
243 2012-02-01 3202
244 2012-03-01 3550
245 2012-04-01 3409
246 2012-05-01 3786
247 2012-06-01 3816
248 2012-07-01 3733
249 2012-08-01 3752
250 2012-09-01 3503
251 2012-10-01 3626
252 2012-11-01 3869
253 2012-12-01 5124
254 2013-01-01 3155
255 2013-02-01 3227
256 2013-03-01 3624
257 2013-04-01 3488
258 2013-05-01 3947
259 2013-06-01 3809
260 2013-07-01 4034
261 2013-08-01 4100
262 2013-09-01 3631
263 2013-10-01 3787
264 2013-11-01 4059
265 2013-12-01 5215
266 2014-01-01 3381
267 2014-02-01 3310
268 2014-03-01 3652
269 2014-04-01 3702
270 2014-05-01 4165
271 2014-06-01 4036
272 2014-07-01 4242
273 2014-08-01 4219
274 2014-09-01 3814
275 2014-10-01 4090
276 2014-11-01 4103
277 2014-12-01 5572
278 2015-01-01 3572
279 2015-02-01 3482
280 2015-03-01 3857
281 2015-04-01 3867
282 2015-05-01 4335
283 2015-06-01 4217
284 2015-07-01 4532
285 2015-08-01 4260
286 2015-09-01 4073
287 2015-10-01 4273
288 2015-11-01 4266
289 2015-12-01 5816
290 2016-01-01 3607
291 2016-02-01 3769
292 2016-03-01 4045
293 2016-04-01 4108
294 2016-05-01 4396
295 2016-06-01 4468
296 2016-07-01 4745
297 2016-08-01 4475
298 2016-09-01 4431
299 2016-10-01 4436
300 2016-11-01 4676
301 2016-12-01 6057
302 2017-01-01 3740
303 2017-02-01 3774
304 2017-03-01 4266
305 2017-04-01 4273
306 2017-05-01 4673
307 2017-06-01 4703
308 2017-07-01 4828
309 2017-08-01 4677
310 2017-09-01 4568
311 2017-10-01 4567
312 2017-11-01 4879
313 2017-12-01 6284
314 2018-01-01 3991
315 2018-02-01 3992
316 2018-03-01 4670
317 2018-04-01 4362
318 2018-05-01 4950
319 2018-06-01 4990
320 2018-07-01 5011
321 2018-08-01 4945
322 2018-09-01 4650
323 2018-10-01 4789
324 2018-11-01 5176
325 2018-12-01 6442
326 2019-01-01 4134
327 2019-02-01 4116
328 2019-03-01 4673
329 2019-04-01 4580
330 2019-05-01 5109
331 2019-06-01 5011
332 2019-07-01 5245
333 2019-08-01 5270
334 2019-09-01 4680
335 2019-10-01 4913
336 2019-11-01 5312
337 2019-12-01 6630
338 2020-01-01 4388
339 2020-02-01 4533
340 2020-03-01 5562
341 2020-04-01 5207

@ -0,0 +1,18 @@
Account Number,Company,Contact,Account Manager,Product,Licenses,Sale Price,Status
2123398, Google,Larry Pager,Edward Thorp,Analytics,150,2100000,Presented
2123398, Google,Larry Pager,Edward Thorp,Prediction,150,700000,Presented
2123398, Google,Larry Pager,Edward Thorp,Tracking,300,350000,Under Review
2192650,BOBO,Larry Pager,Edward Thorp,Analytics,150,2450000,Lost
420496,IKEA,Elon Tusk,Edward Thorp,Analytics,300,4550000,Won
636685,Tesla Inc.,Elon Tusk,Edward Thorp,Analytics,300,2800000,Under Review
636685,Tesla Inc.,Elon Tusk,Edward Thorp,Prediction,150,700000,Presented
1216870,Microsoft,Will Grates,Edward Thorp,Tracking,300,350000,Under Review
2200450,Walmart,Will Grates,Edward Thorp,Analytics,150,2450000,Lost
405886,Apple,Cindy Phoner,Claude Shannon,Analytics,300,4550000,Won
470248,Exxon Mobile,Cindy Phoner,Claude Shannon,Analytics,150,2100000,Presented
698032,ATT,Cindy Phoner,Claude Shannon,Tracking,150,350000,Under Review
698032,ATT,Cindy Phoner,Claude Shannon,Prediction,150,700000,Presented
902797,CVS Health,Emma Gordian,Claude Shannon,Tracking,450,490000,Won
2046943,Salesforce,Emma Gordian,Claude Shannon,Analytics,750,7000000,Won
2169499,Cisco,Emma Gordian,Claude Shannon,Analytics,300,4550000,Lost
2169499,Cisco,Emma Gordian,Claude Shannon,GPS Positioning,300,350000,Presented
1 Account Number Company Contact Account Manager Product Licenses Sale Price Status
2 2123398 Google Larry Pager Edward Thorp Analytics 150 2100000 Presented
3 2123398 Google Larry Pager Edward Thorp Prediction 150 700000 Presented
4 2123398 Google Larry Pager Edward Thorp Tracking 300 350000 Under Review
5 2192650 BOBO Larry Pager Edward Thorp Analytics 150 2450000 Lost
6 420496 IKEA Elon Tusk Edward Thorp Analytics 300 4550000 Won
7 636685 Tesla Inc. Elon Tusk Edward Thorp Analytics 300 2800000 Under Review
8 636685 Tesla Inc. Elon Tusk Edward Thorp Prediction 150 700000 Presented
9 1216870 Microsoft Will Grates Edward Thorp Tracking 300 350000 Under Review
10 2200450 Walmart Will Grates Edward Thorp Analytics 150 2450000 Lost
11 405886 Apple Cindy Phoner Claude Shannon Analytics 300 4550000 Won
12 470248 Exxon Mobile Cindy Phoner Claude Shannon Analytics 150 2100000 Presented
13 698032 ATT Cindy Phoner Claude Shannon Tracking 150 350000 Under Review
14 698032 ATT Cindy Phoner Claude Shannon Prediction 150 700000 Presented
15 902797 CVS Health Emma Gordian Claude Shannon Tracking 450 490000 Won
16 2046943 Salesforce Emma Gordian Claude Shannon Analytics 750 7000000 Won
17 2169499 Cisco Emma Gordian Claude Shannon Analytics 300 4550000 Lost
18 2169499 Cisco Emma Gordian Claude Shannon GPS Positioning 300 350000 Presented

@ -0,0 +1,5 @@
a,b,c,d
0,1,2,3
4,5,6,7
8,9,10,11
12,13,14,15
1 a b c d
2 0 1 2 3
3 4 5 6 7
4 8 9 10 11
5 12 13 14 15

Binary file not shown.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,6 @@
first_name,last_name,age,sex,pre_movie_score,post_movie_score
Tom,Hanks,63.0,m,8.0,10.0
,,,,,
Hugh,Jackman,51.0,m,,
Oprah,Winfrey,66.0,f,6.0,8.0
Emma,Stone,31.0,f,7.0,9.0
1 first_name last_name age sex pre_movie_score post_movie_score
2 Tom Hanks 63.0 m 8.0 10.0
3
4 Hugh Jackman 51.0 m
5 Oprah Winfrey 66.0 f 6.0 8.0
6 Emma Stone 31.0 f 7.0 9.0

@ -0,0 +1,399 @@
mpg,cylinders,displacement,horsepower,weight,acceleration,model_year,origin,name
18,8,307,130,3504,12,70,1,chevrolet chevelle malibu
15,8,350,165,3693,11.5,70,1,buick skylark 320
18,8,318,150,3436,11,70,1,plymouth satellite
16,8,304,150,3433,12,70,1,amc rebel sst
17,8,302,140,3449,10.5,70,1,ford torino
15,8,429,198,4341,10,70,1,ford galaxie 500
14,8,454,220,4354,9,70,1,chevrolet impala
14,8,440,215,4312,8.5,70,1,plymouth fury iii
14,8,455,225,4425,10,70,1,pontiac catalina
15,8,390,190,3850,8.5,70,1,amc ambassador dpl
15,8,383,170,3563,10,70,1,dodge challenger se
14,8,340,160,3609,8,70,1,plymouth 'cuda 340
15,8,400,150,3761,9.5,70,1,chevrolet monte carlo
14,8,455,225,3086,10,70,1,buick estate wagon (sw)
24,4,113,95,2372,15,70,3,toyota corona mark ii
22,6,198,95,2833,15.5,70,1,plymouth duster
18,6,199,97,2774,15.5,70,1,amc hornet
21,6,200,85,2587,16,70,1,ford maverick
27,4,97,88,2130,14.5,70,3,datsun pl510
26,4,97,46,1835,20.5,70,2,volkswagen 1131 deluxe sedan
25,4,110,87,2672,17.5,70,2,peugeot 504
24,4,107,90,2430,14.5,70,2,audi 100 ls
25,4,104,95,2375,17.5,70,2,saab 99e
26,4,121,113,2234,12.5,70,2,bmw 2002
21,6,199,90,2648,15,70,1,amc gremlin
10,8,360,215,4615,14,70,1,ford f250
10,8,307,200,4376,15,70,1,chevy c20
11,8,318,210,4382,13.5,70,1,dodge d200
9,8,304,193,4732,18.5,70,1,hi 1200d
27,4,97,88,2130,14.5,71,3,datsun pl510
28,4,140,90,2264,15.5,71,1,chevrolet vega 2300
25,4,113,95,2228,14,71,3,toyota corona
25,4,98,?,2046,19,71,1,ford pinto
19,6,232,100,2634,13,71,1,amc gremlin
16,6,225,105,3439,15.5,71,1,plymouth satellite custom
17,6,250,100,3329,15.5,71,1,chevrolet chevelle malibu
19,6,250,88,3302,15.5,71,1,ford torino 500
18,6,232,100,3288,15.5,71,1,amc matador
14,8,350,165,4209,12,71,1,chevrolet impala
14,8,400,175,4464,11.5,71,1,pontiac catalina brougham
14,8,351,153,4154,13.5,71,1,ford galaxie 500
14,8,318,150,4096,13,71,1,plymouth fury iii
12,8,383,180,4955,11.5,71,1,dodge monaco (sw)
13,8,400,170,4746,12,71,1,ford country squire (sw)
13,8,400,175,5140,12,71,1,pontiac safari (sw)
18,6,258,110,2962,13.5,71,1,amc hornet sportabout (sw)
22,4,140,72,2408,19,71,1,chevrolet vega (sw)
19,6,250,100,3282,15,71,1,pontiac firebird
18,6,250,88,3139,14.5,71,1,ford mustang
23,4,122,86,2220,14,71,1,mercury capri 2000
28,4,116,90,2123,14,71,2,opel 1900
30,4,79,70,2074,19.5,71,2,peugeot 304
30,4,88,76,2065,14.5,71,2,fiat 124b
31,4,71,65,1773,19,71,3,toyota corolla 1200
35,4,72,69,1613,18,71,3,datsun 1200
27,4,97,60,1834,19,71,2,volkswagen model 111
26,4,91,70,1955,20.5,71,1,plymouth cricket
24,4,113,95,2278,15.5,72,3,toyota corona hardtop
25,4,97.5,80,2126,17,72,1,dodge colt hardtop
23,4,97,54,2254,23.5,72,2,volkswagen type 3
20,4,140,90,2408,19.5,72,1,chevrolet vega
21,4,122,86,2226,16.5,72,1,ford pinto runabout
13,8,350,165,4274,12,72,1,chevrolet impala
14,8,400,175,4385,12,72,1,pontiac catalina
15,8,318,150,4135,13.5,72,1,plymouth fury iii
14,8,351,153,4129,13,72,1,ford galaxie 500
17,8,304,150,3672,11.5,72,1,amc ambassador sst
11,8,429,208,4633,11,72,1,mercury marquis
13,8,350,155,4502,13.5,72,1,buick lesabre custom
12,8,350,160,4456,13.5,72,1,oldsmobile delta 88 royale
13,8,400,190,4422,12.5,72,1,chrysler newport royal
19,3,70,97,2330,13.5,72,3,mazda rx2 coupe
15,8,304,150,3892,12.5,72,1,amc matador (sw)
13,8,307,130,4098,14,72,1,chevrolet chevelle concours (sw)
13,8,302,140,4294,16,72,1,ford gran torino (sw)
14,8,318,150,4077,14,72,1,plymouth satellite custom (sw)
18,4,121,112,2933,14.5,72,2,volvo 145e (sw)
22,4,121,76,2511,18,72,2,volkswagen 411 (sw)
21,4,120,87,2979,19.5,72,2,peugeot 504 (sw)
26,4,96,69,2189,18,72,2,renault 12 (sw)
22,4,122,86,2395,16,72,1,ford pinto (sw)
28,4,97,92,2288,17,72,3,datsun 510 (sw)
23,4,120,97,2506,14.5,72,3,toyouta corona mark ii (sw)
28,4,98,80,2164,15,72,1,dodge colt (sw)
27,4,97,88,2100,16.5,72,3,toyota corolla 1600 (sw)
13,8,350,175,4100,13,73,1,buick century 350
14,8,304,150,3672,11.5,73,1,amc matador
13,8,350,145,3988,13,73,1,chevrolet malibu
14,8,302,137,4042,14.5,73,1,ford gran torino
15,8,318,150,3777,12.5,73,1,dodge coronet custom
12,8,429,198,4952,11.5,73,1,mercury marquis brougham
13,8,400,150,4464,12,73,1,chevrolet caprice classic
13,8,351,158,4363,13,73,1,ford ltd
14,8,318,150,4237,14.5,73,1,plymouth fury gran sedan
13,8,440,215,4735,11,73,1,chrysler new yorker brougham
12,8,455,225,4951,11,73,1,buick electra 225 custom
13,8,360,175,3821,11,73,1,amc ambassador brougham
18,6,225,105,3121,16.5,73,1,plymouth valiant
16,6,250,100,3278,18,73,1,chevrolet nova custom
18,6,232,100,2945,16,73,1,amc hornet
18,6,250,88,3021,16.5,73,1,ford maverick
23,6,198,95,2904,16,73,1,plymouth duster
26,4,97,46,1950,21,73,2,volkswagen super beetle
11,8,400,150,4997,14,73,1,chevrolet impala
12,8,400,167,4906,12.5,73,1,ford country
13,8,360,170,4654,13,73,1,plymouth custom suburb
12,8,350,180,4499,12.5,73,1,oldsmobile vista cruiser
18,6,232,100,2789,15,73,1,amc gremlin
20,4,97,88,2279,19,73,3,toyota carina
21,4,140,72,2401,19.5,73,1,chevrolet vega
22,4,108,94,2379,16.5,73,3,datsun 610
18,3,70,90,2124,13.5,73,3,maxda rx3
19,4,122,85,2310,18.5,73,1,ford pinto
21,6,155,107,2472,14,73,1,mercury capri v6
26,4,98,90,2265,15.5,73,2,fiat 124 sport coupe
15,8,350,145,4082,13,73,1,chevrolet monte carlo s
16,8,400,230,4278,9.5,73,1,pontiac grand prix
29,4,68,49,1867,19.5,73,2,fiat 128
24,4,116,75,2158,15.5,73,2,opel manta
20,4,114,91,2582,14,73,2,audi 100ls
19,4,121,112,2868,15.5,73,2,volvo 144ea
15,8,318,150,3399,11,73,1,dodge dart custom
24,4,121,110,2660,14,73,2,saab 99le
20,6,156,122,2807,13.5,73,3,toyota mark ii
11,8,350,180,3664,11,73,1,oldsmobile omega
20,6,198,95,3102,16.5,74,1,plymouth duster
21,6,200,?,2875,17,74,1,ford maverick
19,6,232,100,2901,16,74,1,amc hornet
15,6,250,100,3336,17,74,1,chevrolet nova
31,4,79,67,1950,19,74,3,datsun b210
26,4,122,80,2451,16.5,74,1,ford pinto
32,4,71,65,1836,21,74,3,toyota corolla 1200
25,4,140,75,2542,17,74,1,chevrolet vega
16,6,250,100,3781,17,74,1,chevrolet chevelle malibu classic
16,6,258,110,3632,18,74,1,amc matador
18,6,225,105,3613,16.5,74,1,plymouth satellite sebring
16,8,302,140,4141,14,74,1,ford gran torino
13,8,350,150,4699,14.5,74,1,buick century luxus (sw)
14,8,318,150,4457,13.5,74,1,dodge coronet custom (sw)
14,8,302,140,4638,16,74,1,ford gran torino (sw)
14,8,304,150,4257,15.5,74,1,amc matador (sw)
29,4,98,83,2219,16.5,74,2,audi fox
26,4,79,67,1963,15.5,74,2,volkswagen dasher
26,4,97,78,2300,14.5,74,2,opel manta
31,4,76,52,1649,16.5,74,3,toyota corona
32,4,83,61,2003,19,74,3,datsun 710
28,4,90,75,2125,14.5,74,1,dodge colt
24,4,90,75,2108,15.5,74,2,fiat 128
26,4,116,75,2246,14,74,2,fiat 124 tc
24,4,120,97,2489,15,74,3,honda civic
26,4,108,93,2391,15.5,74,3,subaru
31,4,79,67,2000,16,74,2,fiat x1.9
19,6,225,95,3264,16,75,1,plymouth valiant custom
18,6,250,105,3459,16,75,1,chevrolet nova
15,6,250,72,3432,21,75,1,mercury monarch
15,6,250,72,3158,19.5,75,1,ford maverick
16,8,400,170,4668,11.5,75,1,pontiac catalina
15,8,350,145,4440,14,75,1,chevrolet bel air
16,8,318,150,4498,14.5,75,1,plymouth grand fury
14,8,351,148,4657,13.5,75,1,ford ltd
17,6,231,110,3907,21,75,1,buick century
16,6,250,105,3897,18.5,75,1,chevroelt chevelle malibu
15,6,258,110,3730,19,75,1,amc matador
18,6,225,95,3785,19,75,1,plymouth fury
21,6,231,110,3039,15,75,1,buick skyhawk
20,8,262,110,3221,13.5,75,1,chevrolet monza 2+2
13,8,302,129,3169,12,75,1,ford mustang ii
29,4,97,75,2171,16,75,3,toyota corolla
23,4,140,83,2639,17,75,1,ford pinto
20,6,232,100,2914,16,75,1,amc gremlin
23,4,140,78,2592,18.5,75,1,pontiac astro
24,4,134,96,2702,13.5,75,3,toyota corona
25,4,90,71,2223,16.5,75,2,volkswagen dasher
24,4,119,97,2545,17,75,3,datsun 710
18,6,171,97,2984,14.5,75,1,ford pinto
29,4,90,70,1937,14,75,2,volkswagen rabbit
19,6,232,90,3211,17,75,1,amc pacer
23,4,115,95,2694,15,75,2,audi 100ls
23,4,120,88,2957,17,75,2,peugeot 504
22,4,121,98,2945,14.5,75,2,volvo 244dl
25,4,121,115,2671,13.5,75,2,saab 99le
33,4,91,53,1795,17.5,75,3,honda civic cvcc
28,4,107,86,2464,15.5,76,2,fiat 131
25,4,116,81,2220,16.9,76,2,opel 1900
25,4,140,92,2572,14.9,76,1,capri ii
26,4,98,79,2255,17.7,76,1,dodge colt
27,4,101,83,2202,15.3,76,2,renault 12tl
17.5,8,305,140,4215,13,76,1,chevrolet chevelle malibu classic
16,8,318,150,4190,13,76,1,dodge coronet brougham
15.5,8,304,120,3962,13.9,76,1,amc matador
14.5,8,351,152,4215,12.8,76,1,ford gran torino
22,6,225,100,3233,15.4,76,1,plymouth valiant
22,6,250,105,3353,14.5,76,1,chevrolet nova
24,6,200,81,3012,17.6,76,1,ford maverick
22.5,6,232,90,3085,17.6,76,1,amc hornet
29,4,85,52,2035,22.2,76,1,chevrolet chevette
24.5,4,98,60,2164,22.1,76,1,chevrolet woody
29,4,90,70,1937,14.2,76,2,vw rabbit
33,4,91,53,1795,17.4,76,3,honda civic
20,6,225,100,3651,17.7,76,1,dodge aspen se
18,6,250,78,3574,21,76,1,ford granada ghia
18.5,6,250,110,3645,16.2,76,1,pontiac ventura sj
17.5,6,258,95,3193,17.8,76,1,amc pacer d/l
29.5,4,97,71,1825,12.2,76,2,volkswagen rabbit
32,4,85,70,1990,17,76,3,datsun b-210
28,4,97,75,2155,16.4,76,3,toyota corolla
26.5,4,140,72,2565,13.6,76,1,ford pinto
20,4,130,102,3150,15.7,76,2,volvo 245
13,8,318,150,3940,13.2,76,1,plymouth volare premier v8
19,4,120,88,3270,21.9,76,2,peugeot 504
19,6,156,108,2930,15.5,76,3,toyota mark ii
16.5,6,168,120,3820,16.7,76,2,mercedes-benz 280s
16.5,8,350,180,4380,12.1,76,1,cadillac seville
13,8,350,145,4055,12,76,1,chevy c10
13,8,302,130,3870,15,76,1,ford f108
13,8,318,150,3755,14,76,1,dodge d100
31.5,4,98,68,2045,18.5,77,3,honda accord cvcc
30,4,111,80,2155,14.8,77,1,buick opel isuzu deluxe
36,4,79,58,1825,18.6,77,2,renault 5 gtl
25.5,4,122,96,2300,15.5,77,1,plymouth arrow gs
33.5,4,85,70,1945,16.8,77,3,datsun f-10 hatchback
17.5,8,305,145,3880,12.5,77,1,chevrolet caprice classic
17,8,260,110,4060,19,77,1,oldsmobile cutlass supreme
15.5,8,318,145,4140,13.7,77,1,dodge monaco brougham
15,8,302,130,4295,14.9,77,1,mercury cougar brougham
17.5,6,250,110,3520,16.4,77,1,chevrolet concours
20.5,6,231,105,3425,16.9,77,1,buick skylark
19,6,225,100,3630,17.7,77,1,plymouth volare custom
18.5,6,250,98,3525,19,77,1,ford granada
16,8,400,180,4220,11.1,77,1,pontiac grand prix lj
15.5,8,350,170,4165,11.4,77,1,chevrolet monte carlo landau
15.5,8,400,190,4325,12.2,77,1,chrysler cordoba
16,8,351,149,4335,14.5,77,1,ford thunderbird
29,4,97,78,1940,14.5,77,2,volkswagen rabbit custom
24.5,4,151,88,2740,16,77,1,pontiac sunbird coupe
26,4,97,75,2265,18.2,77,3,toyota corolla liftback
25.5,4,140,89,2755,15.8,77,1,ford mustang ii 2+2
30.5,4,98,63,2051,17,77,1,chevrolet chevette
33.5,4,98,83,2075,15.9,77,1,dodge colt m/m
30,4,97,67,1985,16.4,77,3,subaru dl
30.5,4,97,78,2190,14.1,77,2,volkswagen dasher
22,6,146,97,2815,14.5,77,3,datsun 810
21.5,4,121,110,2600,12.8,77,2,bmw 320i
21.5,3,80,110,2720,13.5,77,3,mazda rx-4
43.1,4,90,48,1985,21.5,78,2,volkswagen rabbit custom diesel
36.1,4,98,66,1800,14.4,78,1,ford fiesta
32.8,4,78,52,1985,19.4,78,3,mazda glc deluxe
39.4,4,85,70,2070,18.6,78,3,datsun b210 gx
36.1,4,91,60,1800,16.4,78,3,honda civic cvcc
19.9,8,260,110,3365,15.5,78,1,oldsmobile cutlass salon brougham
19.4,8,318,140,3735,13.2,78,1,dodge diplomat
20.2,8,302,139,3570,12.8,78,1,mercury monarch ghia
19.2,6,231,105,3535,19.2,78,1,pontiac phoenix lj
20.5,6,200,95,3155,18.2,78,1,chevrolet malibu
20.2,6,200,85,2965,15.8,78,1,ford fairmont (auto)
25.1,4,140,88,2720,15.4,78,1,ford fairmont (man)
20.5,6,225,100,3430,17.2,78,1,plymouth volare
19.4,6,232,90,3210,17.2,78,1,amc concord
20.6,6,231,105,3380,15.8,78,1,buick century special
20.8,6,200,85,3070,16.7,78,1,mercury zephyr
18.6,6,225,110,3620,18.7,78,1,dodge aspen
18.1,6,258,120,3410,15.1,78,1,amc concord d/l
19.2,8,305,145,3425,13.2,78,1,chevrolet monte carlo landau
17.7,6,231,165,3445,13.4,78,1,buick regal sport coupe (turbo)
18.1,8,302,139,3205,11.2,78,1,ford futura
17.5,8,318,140,4080,13.7,78,1,dodge magnum xe
30,4,98,68,2155,16.5,78,1,chevrolet chevette
27.5,4,134,95,2560,14.2,78,3,toyota corona
27.2,4,119,97,2300,14.7,78,3,datsun 510
30.9,4,105,75,2230,14.5,78,1,dodge omni
21.1,4,134,95,2515,14.8,78,3,toyota celica gt liftback
23.2,4,156,105,2745,16.7,78,1,plymouth sapporo
23.8,4,151,85,2855,17.6,78,1,oldsmobile starfire sx
23.9,4,119,97,2405,14.9,78,3,datsun 200-sx
20.3,5,131,103,2830,15.9,78,2,audi 5000
17,6,163,125,3140,13.6,78,2,volvo 264gl
21.6,4,121,115,2795,15.7,78,2,saab 99gle
16.2,6,163,133,3410,15.8,78,2,peugeot 604sl
31.5,4,89,71,1990,14.9,78,2,volkswagen scirocco
29.5,4,98,68,2135,16.6,78,3,honda accord lx
21.5,6,231,115,3245,15.4,79,1,pontiac lemans v6
19.8,6,200,85,2990,18.2,79,1,mercury zephyr 6
22.3,4,140,88,2890,17.3,79,1,ford fairmont 4
20.2,6,232,90,3265,18.2,79,1,amc concord dl 6
20.6,6,225,110,3360,16.6,79,1,dodge aspen 6
17,8,305,130,3840,15.4,79,1,chevrolet caprice classic
17.6,8,302,129,3725,13.4,79,1,ford ltd landau
16.5,8,351,138,3955,13.2,79,1,mercury grand marquis
18.2,8,318,135,3830,15.2,79,1,dodge st. regis
16.9,8,350,155,4360,14.9,79,1,buick estate wagon (sw)
15.5,8,351,142,4054,14.3,79,1,ford country squire (sw)
19.2,8,267,125,3605,15,79,1,chevrolet malibu classic (sw)
18.5,8,360,150,3940,13,79,1,chrysler lebaron town @ country (sw)
31.9,4,89,71,1925,14,79,2,vw rabbit custom
34.1,4,86,65,1975,15.2,79,3,maxda glc deluxe
35.7,4,98,80,1915,14.4,79,1,dodge colt hatchback custom
27.4,4,121,80,2670,15,79,1,amc spirit dl
25.4,5,183,77,3530,20.1,79,2,mercedes benz 300d
23,8,350,125,3900,17.4,79,1,cadillac eldorado
27.2,4,141,71,3190,24.8,79,2,peugeot 504
23.9,8,260,90,3420,22.2,79,1,oldsmobile cutlass salon brougham
34.2,4,105,70,2200,13.2,79,1,plymouth horizon
34.5,4,105,70,2150,14.9,79,1,plymouth horizon tc3
31.8,4,85,65,2020,19.2,79,3,datsun 210
37.3,4,91,69,2130,14.7,79,2,fiat strada custom
28.4,4,151,90,2670,16,79,1,buick skylark limited
28.8,6,173,115,2595,11.3,79,1,chevrolet citation
26.8,6,173,115,2700,12.9,79,1,oldsmobile omega brougham
33.5,4,151,90,2556,13.2,79,1,pontiac phoenix
41.5,4,98,76,2144,14.7,80,2,vw rabbit
38.1,4,89,60,1968,18.8,80,3,toyota corolla tercel
32.1,4,98,70,2120,15.5,80,1,chevrolet chevette
37.2,4,86,65,2019,16.4,80,3,datsun 310
28,4,151,90,2678,16.5,80,1,chevrolet citation
26.4,4,140,88,2870,18.1,80,1,ford fairmont
24.3,4,151,90,3003,20.1,80,1,amc concord
19.1,6,225,90,3381,18.7,80,1,dodge aspen
34.3,4,97,78,2188,15.8,80,2,audi 4000
29.8,4,134,90,2711,15.5,80,3,toyota corona liftback
31.3,4,120,75,2542,17.5,80,3,mazda 626
37,4,119,92,2434,15,80,3,datsun 510 hatchback
32.2,4,108,75,2265,15.2,80,3,toyota corolla
46.6,4,86,65,2110,17.9,80,3,mazda glc
27.9,4,156,105,2800,14.4,80,1,dodge colt
40.8,4,85,65,2110,19.2,80,3,datsun 210
44.3,4,90,48,2085,21.7,80,2,vw rabbit c (diesel)
43.4,4,90,48,2335,23.7,80,2,vw dasher (diesel)
36.4,5,121,67,2950,19.9,80,2,audi 5000s (diesel)
30,4,146,67,3250,21.8,80,2,mercedes-benz 240d
44.6,4,91,67,1850,13.8,80,3,honda civic 1500 gl
40.9,4,85,?,1835,17.3,80,2,renault lecar deluxe
33.8,4,97,67,2145,18,80,3,subaru dl
29.8,4,89,62,1845,15.3,80,2,vokswagen rabbit
32.7,6,168,132,2910,11.4,80,3,datsun 280-zx
23.7,3,70,100,2420,12.5,80,3,mazda rx-7 gs
35,4,122,88,2500,15.1,80,2,triumph tr7 coupe
23.6,4,140,?,2905,14.3,80,1,ford mustang cobra
32.4,4,107,72,2290,17,80,3,honda accord
27.2,4,135,84,2490,15.7,81,1,plymouth reliant
26.6,4,151,84,2635,16.4,81,1,buick skylark
25.8,4,156,92,2620,14.4,81,1,dodge aries wagon (sw)
23.5,6,173,110,2725,12.6,81,1,chevrolet citation
30,4,135,84,2385,12.9,81,1,plymouth reliant
39.1,4,79,58,1755,16.9,81,3,toyota starlet
39,4,86,64,1875,16.4,81,1,plymouth champ
35.1,4,81,60,1760,16.1,81,3,honda civic 1300
32.3,4,97,67,2065,17.8,81,3,subaru
37,4,85,65,1975,19.4,81,3,datsun 210 mpg
37.7,4,89,62,2050,17.3,81,3,toyota tercel
34.1,4,91,68,1985,16,81,3,mazda glc 4
34.7,4,105,63,2215,14.9,81,1,plymouth horizon 4
34.4,4,98,65,2045,16.2,81,1,ford escort 4w
29.9,4,98,65,2380,20.7,81,1,ford escort 2h
33,4,105,74,2190,14.2,81,2,volkswagen jetta
34.5,4,100,?,2320,15.8,81,2,renault 18i
33.7,4,107,75,2210,14.4,81,3,honda prelude
32.4,4,108,75,2350,16.8,81,3,toyota corolla
32.9,4,119,100,2615,14.8,81,3,datsun 200sx
31.6,4,120,74,2635,18.3,81,3,mazda 626
28.1,4,141,80,3230,20.4,81,2,peugeot 505s turbo diesel
30.7,6,145,76,3160,19.6,81,2,volvo diesel
25.4,6,168,116,2900,12.6,81,3,toyota cressida
24.2,6,146,120,2930,13.8,81,3,datsun 810 maxima
22.4,6,231,110,3415,15.8,81,1,buick century
26.6,8,350,105,3725,19,81,1,oldsmobile cutlass ls
20.2,6,200,88,3060,17.1,81,1,ford granada gl
17.6,6,225,85,3465,16.6,81,1,chrysler lebaron salon
28,4,112,88,2605,19.6,82,1,chevrolet cavalier
27,4,112,88,2640,18.6,82,1,chevrolet cavalier wagon
34,4,112,88,2395,18,82,1,chevrolet cavalier 2-door
31,4,112,85,2575,16.2,82,1,pontiac j2000 se hatchback
29,4,135,84,2525,16,82,1,dodge aries se
27,4,151,90,2735,18,82,1,pontiac phoenix
24,4,140,92,2865,16.4,82,1,ford fairmont futura
23,4,151,?,3035,20.5,82,1,amc concord dl
36,4,105,74,1980,15.3,82,2,volkswagen rabbit l
37,4,91,68,2025,18.2,82,3,mazda glc custom l
31,4,91,68,1970,17.6,82,3,mazda glc custom
38,4,105,63,2125,14.7,82,1,plymouth horizon miser
36,4,98,70,2125,17.3,82,1,mercury lynx l
36,4,120,88,2160,14.5,82,3,nissan stanza xe
36,4,107,75,2205,14.5,82,3,honda accord
34,4,108,70,2245,16.9,82,3,toyota corolla
38,4,91,67,1965,15,82,3,honda civic
32,4,91,67,1965,15.7,82,3,honda civic (auto)
38,4,91,67,1995,16.2,82,3,datsun 310 gx
25,6,181,110,2945,16.4,82,1,buick century limited
38,6,262,85,3015,17,82,1,oldsmobile cutlass ciera (diesel)
26,4,156,92,2585,14.5,82,1,chrysler lebaron medallion
22,6,232,112,2835,14.7,82,1,ford granada l
32,4,144,96,2665,13.9,82,3,toyota celica gt
36,4,135,84,2370,13,82,1,dodge charger 2.2
27,4,151,90,2950,17.3,82,1,chevrolet camaro
27,4,140,86,2790,15.6,82,1,ford mustang gl
44,4,97,52,2130,24.6,82,2,vw pickup
32,4,135,84,2295,11.6,82,1,dodge rampage
28,4,120,79,2625,18.6,82,1,ford ranger
31,4,119,82,2720,19.4,82,1,chevy s-10
1 mpg cylinders displacement horsepower weight acceleration model_year origin name
2 18 8 307 130 3504 12 70 1 chevrolet chevelle malibu
3 15 8 350 165 3693 11.5 70 1 buick skylark 320
4 18 8 318 150 3436 11 70 1 plymouth satellite
5 16 8 304 150 3433 12 70 1 amc rebel sst
6 17 8 302 140 3449 10.5 70 1 ford torino
7 15 8 429 198 4341 10 70 1 ford galaxie 500
8 14 8 454 220 4354 9 70 1 chevrolet impala
9 14 8 440 215 4312 8.5 70 1 plymouth fury iii
10 14 8 455 225 4425 10 70 1 pontiac catalina
11 15 8 390 190 3850 8.5 70 1 amc ambassador dpl
12 15 8 383 170 3563 10 70 1 dodge challenger se
13 14 8 340 160 3609 8 70 1 plymouth 'cuda 340
14 15 8 400 150 3761 9.5 70 1 chevrolet monte carlo
15 14 8 455 225 3086 10 70 1 buick estate wagon (sw)
16 24 4 113 95 2372 15 70 3 toyota corona mark ii
17 22 6 198 95 2833 15.5 70 1 plymouth duster
18 18 6 199 97 2774 15.5 70 1 amc hornet
19 21 6 200 85 2587 16 70 1 ford maverick
20 27 4 97 88 2130 14.5 70 3 datsun pl510
21 26 4 97 46 1835 20.5 70 2 volkswagen 1131 deluxe sedan
22 25 4 110 87 2672 17.5 70 2 peugeot 504
23 24 4 107 90 2430 14.5 70 2 audi 100 ls
24 25 4 104 95 2375 17.5 70 2 saab 99e
25 26 4 121 113 2234 12.5 70 2 bmw 2002
26 21 6 199 90 2648 15 70 1 amc gremlin
27 10 8 360 215 4615 14 70 1 ford f250
28 10 8 307 200 4376 15 70 1 chevy c20
29 11 8 318 210 4382 13.5 70 1 dodge d200
30 9 8 304 193 4732 18.5 70 1 hi 1200d
31 27 4 97 88 2130 14.5 71 3 datsun pl510
32 28 4 140 90 2264 15.5 71 1 chevrolet vega 2300
33 25 4 113 95 2228 14 71 3 toyota corona
34 25 4 98 ? 2046 19 71 1 ford pinto
35 19 6 232 100 2634 13 71 1 amc gremlin
36 16 6 225 105 3439 15.5 71 1 plymouth satellite custom
37 17 6 250 100 3329 15.5 71 1 chevrolet chevelle malibu
38 19 6 250 88 3302 15.5 71 1 ford torino 500
39 18 6 232 100 3288 15.5 71 1 amc matador
40 14 8 350 165 4209 12 71 1 chevrolet impala
41 14 8 400 175 4464 11.5 71 1 pontiac catalina brougham
42 14 8 351 153 4154 13.5 71 1 ford galaxie 500
43 14 8 318 150 4096 13 71 1 plymouth fury iii
44 12 8 383 180 4955 11.5 71 1 dodge monaco (sw)
45 13 8 400 170 4746 12 71 1 ford country squire (sw)
46 13 8 400 175 5140 12 71 1 pontiac safari (sw)
47 18 6 258 110 2962 13.5 71 1 amc hornet sportabout (sw)
48 22 4 140 72 2408 19 71 1 chevrolet vega (sw)
49 19 6 250 100 3282 15 71 1 pontiac firebird
50 18 6 250 88 3139 14.5 71 1 ford mustang
51 23 4 122 86 2220 14 71 1 mercury capri 2000
52 28 4 116 90 2123 14 71 2 opel 1900
53 30 4 79 70 2074 19.5 71 2 peugeot 304
54 30 4 88 76 2065 14.5 71 2 fiat 124b
55 31 4 71 65 1773 19 71 3 toyota corolla 1200
56 35 4 72 69 1613 18 71 3 datsun 1200
57 27 4 97 60 1834 19 71 2 volkswagen model 111
58 26 4 91 70 1955 20.5 71 1 plymouth cricket
59 24 4 113 95 2278 15.5 72 3 toyota corona hardtop
60 25 4 97.5 80 2126 17 72 1 dodge colt hardtop
61 23 4 97 54 2254 23.5 72 2 volkswagen type 3
62 20 4 140 90 2408 19.5 72 1 chevrolet vega
63 21 4 122 86 2226 16.5 72 1 ford pinto runabout
64 13 8 350 165 4274 12 72 1 chevrolet impala
65 14 8 400 175 4385 12 72 1 pontiac catalina
66 15 8 318 150 4135 13.5 72 1 plymouth fury iii
67 14 8 351 153 4129 13 72 1 ford galaxie 500
68 17 8 304 150 3672 11.5 72 1 amc ambassador sst
69 11 8 429 208 4633 11 72 1 mercury marquis
70 13 8 350 155 4502 13.5 72 1 buick lesabre custom
71 12 8 350 160 4456 13.5 72 1 oldsmobile delta 88 royale
72 13 8 400 190 4422 12.5 72 1 chrysler newport royal
73 19 3 70 97 2330 13.5 72 3 mazda rx2 coupe
74 15 8 304 150 3892 12.5 72 1 amc matador (sw)
75 13 8 307 130 4098 14 72 1 chevrolet chevelle concours (sw)
76 13 8 302 140 4294 16 72 1 ford gran torino (sw)
77 14 8 318 150 4077 14 72 1 plymouth satellite custom (sw)
78 18 4 121 112 2933 14.5 72 2 volvo 145e (sw)
79 22 4 121 76 2511 18 72 2 volkswagen 411 (sw)
80 21 4 120 87 2979 19.5 72 2 peugeot 504 (sw)
81 26 4 96 69 2189 18 72 2 renault 12 (sw)
82 22 4 122 86 2395 16 72 1 ford pinto (sw)
83 28 4 97 92 2288 17 72 3 datsun 510 (sw)
84 23 4 120 97 2506 14.5 72 3 toyouta corona mark ii (sw)
85 28 4 98 80 2164 15 72 1 dodge colt (sw)
86 27 4 97 88 2100 16.5 72 3 toyota corolla 1600 (sw)
87 13 8 350 175 4100 13 73 1 buick century 350
88 14 8 304 150 3672 11.5 73 1 amc matador
89 13 8 350 145 3988 13 73 1 chevrolet malibu
90 14 8 302 137 4042 14.5 73 1 ford gran torino
91 15 8 318 150 3777 12.5 73 1 dodge coronet custom
92 12 8 429 198 4952 11.5 73 1 mercury marquis brougham
93 13 8 400 150 4464 12 73 1 chevrolet caprice classic
94 13 8 351 158 4363 13 73 1 ford ltd
95 14 8 318 150 4237 14.5 73 1 plymouth fury gran sedan
96 13 8 440 215 4735 11 73 1 chrysler new yorker brougham
97 12 8 455 225 4951 11 73 1 buick electra 225 custom
98 13 8 360 175 3821 11 73 1 amc ambassador brougham
99 18 6 225 105 3121 16.5 73 1 plymouth valiant
100 16 6 250 100 3278 18 73 1 chevrolet nova custom
101 18 6 232 100 2945 16 73 1 amc hornet
102 18 6 250 88 3021 16.5 73 1 ford maverick
103 23 6 198 95 2904 16 73 1 plymouth duster
104 26 4 97 46 1950 21 73 2 volkswagen super beetle
105 11 8 400 150 4997 14 73 1 chevrolet impala
106 12 8 400 167 4906 12.5 73 1 ford country
107 13 8 360 170 4654 13 73 1 plymouth custom suburb
108 12 8 350 180 4499 12.5 73 1 oldsmobile vista cruiser
109 18 6 232 100 2789 15 73 1 amc gremlin
110 20 4 97 88 2279 19 73 3 toyota carina
111 21 4 140 72 2401 19.5 73 1 chevrolet vega
112 22 4 108 94 2379 16.5 73 3 datsun 610
113 18 3 70 90 2124 13.5 73 3 maxda rx3
114 19 4 122 85 2310 18.5 73 1 ford pinto
115 21 6 155 107 2472 14 73 1 mercury capri v6
116 26 4 98 90 2265 15.5 73 2 fiat 124 sport coupe
117 15 8 350 145 4082 13 73 1 chevrolet monte carlo s
118 16 8 400 230 4278 9.5 73 1 pontiac grand prix
119 29 4 68 49 1867 19.5 73 2 fiat 128
120 24 4 116 75 2158 15.5 73 2 opel manta
121 20 4 114 91 2582 14 73 2 audi 100ls
122 19 4 121 112 2868 15.5 73 2 volvo 144ea
123 15 8 318 150 3399 11 73 1 dodge dart custom
124 24 4 121 110 2660 14 73 2 saab 99le
125 20 6 156 122 2807 13.5 73 3 toyota mark ii
126 11 8 350 180 3664 11 73 1 oldsmobile omega
127 20 6 198 95 3102 16.5 74 1 plymouth duster
128 21 6 200 ? 2875 17 74 1 ford maverick
129 19 6 232 100 2901 16 74 1 amc hornet
130 15 6 250 100 3336 17 74 1 chevrolet nova
131 31 4 79 67 1950 19 74 3 datsun b210
132 26 4 122 80 2451 16.5 74 1 ford pinto
133 32 4 71 65 1836 21 74 3 toyota corolla 1200
134 25 4 140 75 2542 17 74 1 chevrolet vega
135 16 6 250 100 3781 17 74 1 chevrolet chevelle malibu classic
136 16 6 258 110 3632 18 74 1 amc matador
137 18 6 225 105 3613 16.5 74 1 plymouth satellite sebring
138 16 8 302 140 4141 14 74 1 ford gran torino
139 13 8 350 150 4699 14.5 74 1 buick century luxus (sw)
140 14 8 318 150 4457 13.5 74 1 dodge coronet custom (sw)
141 14 8 302 140 4638 16 74 1 ford gran torino (sw)
142 14 8 304 150 4257 15.5 74 1 amc matador (sw)
143 29 4 98 83 2219 16.5 74 2 audi fox
144 26 4 79 67 1963 15.5 74 2 volkswagen dasher
145 26 4 97 78 2300 14.5 74 2 opel manta
146 31 4 76 52 1649 16.5 74 3 toyota corona
147 32 4 83 61 2003 19 74 3 datsun 710
148 28 4 90 75 2125 14.5 74 1 dodge colt
149 24 4 90 75 2108 15.5 74 2 fiat 128
150 26 4 116 75 2246 14 74 2 fiat 124 tc
151 24 4 120 97 2489 15 74 3 honda civic
152 26 4 108 93 2391 15.5 74 3 subaru
153 31 4 79 67 2000 16 74 2 fiat x1.9
154 19 6 225 95 3264 16 75 1 plymouth valiant custom
155 18 6 250 105 3459 16 75 1 chevrolet nova
156 15 6 250 72 3432 21 75 1 mercury monarch
157 15 6 250 72 3158 19.5 75 1 ford maverick
158 16 8 400 170 4668 11.5 75 1 pontiac catalina
159 15 8 350 145 4440 14 75 1 chevrolet bel air
160 16 8 318 150 4498 14.5 75 1 plymouth grand fury
161 14 8 351 148 4657 13.5 75 1 ford ltd
162 17 6 231 110 3907 21 75 1 buick century
163 16 6 250 105 3897 18.5 75 1 chevroelt chevelle malibu
164 15 6 258 110 3730 19 75 1 amc matador
165 18 6 225 95 3785 19 75 1 plymouth fury
166 21 6 231 110 3039 15 75 1 buick skyhawk
167 20 8 262 110 3221 13.5 75 1 chevrolet monza 2+2
168 13 8 302 129 3169 12 75 1 ford mustang ii
169 29 4 97 75 2171 16 75 3 toyota corolla
170 23 4 140 83 2639 17 75 1 ford pinto
171 20 6 232 100 2914 16 75 1 amc gremlin
172 23 4 140 78 2592 18.5 75 1 pontiac astro
173 24 4 134 96 2702 13.5 75 3 toyota corona
174 25 4 90 71 2223 16.5 75 2 volkswagen dasher
175 24 4 119 97 2545 17 75 3 datsun 710
176 18 6 171 97 2984 14.5 75 1 ford pinto
177 29 4 90 70 1937 14 75 2 volkswagen rabbit
178 19 6 232 90 3211 17 75 1 amc pacer
179 23 4 115 95 2694 15 75 2 audi 100ls
180 23 4 120 88 2957 17 75 2 peugeot 504
181 22 4 121 98 2945 14.5 75 2 volvo 244dl
182 25 4 121 115 2671 13.5 75 2 saab 99le
183 33 4 91 53 1795 17.5 75 3 honda civic cvcc
184 28 4 107 86 2464 15.5 76 2 fiat 131
185 25 4 116 81 2220 16.9 76 2 opel 1900
186 25 4 140 92 2572 14.9 76 1 capri ii
187 26 4 98 79 2255 17.7 76 1 dodge colt
188 27 4 101 83 2202 15.3 76 2 renault 12tl
189 17.5 8 305 140 4215 13 76 1 chevrolet chevelle malibu classic
190 16 8 318 150 4190 13 76 1 dodge coronet brougham
191 15.5 8 304 120 3962 13.9 76 1 amc matador
192 14.5 8 351 152 4215 12.8 76 1 ford gran torino
193 22 6 225 100 3233 15.4 76 1 plymouth valiant
194 22 6 250 105 3353 14.5 76 1 chevrolet nova
195 24 6 200 81 3012 17.6 76 1 ford maverick
196 22.5 6 232 90 3085 17.6 76 1 amc hornet
197 29 4 85 52 2035 22.2 76 1 chevrolet chevette
198 24.5 4 98 60 2164 22.1 76 1 chevrolet woody
199 29 4 90 70 1937 14.2 76 2 vw rabbit
200 33 4 91 53 1795 17.4 76 3 honda civic
201 20 6 225 100 3651 17.7 76 1 dodge aspen se
202 18 6 250 78 3574 21 76 1 ford granada ghia
203 18.5 6 250 110 3645 16.2 76 1 pontiac ventura sj
204 17.5 6 258 95 3193 17.8 76 1 amc pacer d/l
205 29.5 4 97 71 1825 12.2 76 2 volkswagen rabbit
206 32 4 85 70 1990 17 76 3 datsun b-210
207 28 4 97 75 2155 16.4 76 3 toyota corolla
208 26.5 4 140 72 2565 13.6 76 1 ford pinto
209 20 4 130 102 3150 15.7 76 2 volvo 245
210 13 8 318 150 3940 13.2 76 1 plymouth volare premier v8
211 19 4 120 88 3270 21.9 76 2 peugeot 504
212 19 6 156 108 2930 15.5 76 3 toyota mark ii
213 16.5 6 168 120 3820 16.7 76 2 mercedes-benz 280s
214 16.5 8 350 180 4380 12.1 76 1 cadillac seville
215 13 8 350 145 4055 12 76 1 chevy c10
216 13 8 302 130 3870 15 76 1 ford f108
217 13 8 318 150 3755 14 76 1 dodge d100
218 31.5 4 98 68 2045 18.5 77 3 honda accord cvcc
219 30 4 111 80 2155 14.8 77 1 buick opel isuzu deluxe
220 36 4 79 58 1825 18.6 77 2 renault 5 gtl
221 25.5 4 122 96 2300 15.5 77 1 plymouth arrow gs
222 33.5 4 85 70 1945 16.8 77 3 datsun f-10 hatchback
223 17.5 8 305 145 3880 12.5 77 1 chevrolet caprice classic
224 17 8 260 110 4060 19 77 1 oldsmobile cutlass supreme
225 15.5 8 318 145 4140 13.7 77 1 dodge monaco brougham
226 15 8 302 130 4295 14.9 77 1 mercury cougar brougham
227 17.5 6 250 110 3520 16.4 77 1 chevrolet concours
228 20.5 6 231 105 3425 16.9 77 1 buick skylark
229 19 6 225 100 3630 17.7 77 1 plymouth volare custom
230 18.5 6 250 98 3525 19 77 1 ford granada
231 16 8 400 180 4220 11.1 77 1 pontiac grand prix lj
232 15.5 8 350 170 4165 11.4 77 1 chevrolet monte carlo landau
233 15.5 8 400 190 4325 12.2 77 1 chrysler cordoba
234 16 8 351 149 4335 14.5 77 1 ford thunderbird
235 29 4 97 78 1940 14.5 77 2 volkswagen rabbit custom
236 24.5 4 151 88 2740 16 77 1 pontiac sunbird coupe
237 26 4 97 75 2265 18.2 77 3 toyota corolla liftback
238 25.5 4 140 89 2755 15.8 77 1 ford mustang ii 2+2
239 30.5 4 98 63 2051 17 77 1 chevrolet chevette
240 33.5 4 98 83 2075 15.9 77 1 dodge colt m/m
241 30 4 97 67 1985 16.4 77 3 subaru dl
242 30.5 4 97 78 2190 14.1 77 2 volkswagen dasher
243 22 6 146 97 2815 14.5 77 3 datsun 810
244 21.5 4 121 110 2600 12.8 77 2 bmw 320i
245 21.5 3 80 110 2720 13.5 77 3 mazda rx-4
246 43.1 4 90 48 1985 21.5 78 2 volkswagen rabbit custom diesel
247 36.1 4 98 66 1800 14.4 78 1 ford fiesta
248 32.8 4 78 52 1985 19.4 78 3 mazda glc deluxe
249 39.4 4 85 70 2070 18.6 78 3 datsun b210 gx
250 36.1 4 91 60 1800 16.4 78 3 honda civic cvcc
251 19.9 8 260 110 3365 15.5 78 1 oldsmobile cutlass salon brougham
252 19.4 8 318 140 3735 13.2 78 1 dodge diplomat
253 20.2 8 302 139 3570 12.8 78 1 mercury monarch ghia
254 19.2 6 231 105 3535 19.2 78 1 pontiac phoenix lj
255 20.5 6 200 95 3155 18.2 78 1 chevrolet malibu
256 20.2 6 200 85 2965 15.8 78 1 ford fairmont (auto)
257 25.1 4 140 88 2720 15.4 78 1 ford fairmont (man)
258 20.5 6 225 100 3430 17.2 78 1 plymouth volare
259 19.4 6 232 90 3210 17.2 78 1 amc concord
260 20.6 6 231 105 3380 15.8 78 1 buick century special
261 20.8 6 200 85 3070 16.7 78 1 mercury zephyr
262 18.6 6 225 110 3620 18.7 78 1 dodge aspen
263 18.1 6 258 120 3410 15.1 78 1 amc concord d/l
264 19.2 8 305 145 3425 13.2 78 1 chevrolet monte carlo landau
265 17.7 6 231 165 3445 13.4 78 1 buick regal sport coupe (turbo)
266 18.1 8 302 139 3205 11.2 78 1 ford futura
267 17.5 8 318 140 4080 13.7 78 1 dodge magnum xe
268 30 4 98 68 2155 16.5 78 1 chevrolet chevette
269 27.5 4 134 95 2560 14.2 78 3 toyota corona
270 27.2 4 119 97 2300 14.7 78 3 datsun 510
271 30.9 4 105 75 2230 14.5 78 1 dodge omni
272 21.1 4 134 95 2515 14.8 78 3 toyota celica gt liftback
273 23.2 4 156 105 2745 16.7 78 1 plymouth sapporo
274 23.8 4 151 85 2855 17.6 78 1 oldsmobile starfire sx
275 23.9 4 119 97 2405 14.9 78 3 datsun 200-sx
276 20.3 5 131 103 2830 15.9 78 2 audi 5000
277 17 6 163 125 3140 13.6 78 2 volvo 264gl
278 21.6 4 121 115 2795 15.7 78 2 saab 99gle
279 16.2 6 163 133 3410 15.8 78 2 peugeot 604sl
280 31.5 4 89 71 1990 14.9 78 2 volkswagen scirocco
281 29.5 4 98 68 2135 16.6 78 3 honda accord lx
282 21.5 6 231 115 3245 15.4 79 1 pontiac lemans v6
283 19.8 6 200 85 2990 18.2 79 1 mercury zephyr 6
284 22.3 4 140 88 2890 17.3 79 1 ford fairmont 4
285 20.2 6 232 90 3265 18.2 79 1 amc concord dl 6
286 20.6 6 225 110 3360 16.6 79 1 dodge aspen 6
287 17 8 305 130 3840 15.4 79 1 chevrolet caprice classic
288 17.6 8 302 129 3725 13.4 79 1 ford ltd landau
289 16.5 8 351 138 3955 13.2 79 1 mercury grand marquis
290 18.2 8 318 135 3830 15.2 79 1 dodge st. regis
291 16.9 8 350 155 4360 14.9 79 1 buick estate wagon (sw)
292 15.5 8 351 142 4054 14.3 79 1 ford country squire (sw)
293 19.2 8 267 125 3605 15 79 1 chevrolet malibu classic (sw)
294 18.5 8 360 150 3940 13 79 1 chrysler lebaron town @ country (sw)
295 31.9 4 89 71 1925 14 79 2 vw rabbit custom
296 34.1 4 86 65 1975 15.2 79 3 maxda glc deluxe
297 35.7 4 98 80 1915 14.4 79 1 dodge colt hatchback custom
298 27.4 4 121 80 2670 15 79 1 amc spirit dl
299 25.4 5 183 77 3530 20.1 79 2 mercedes benz 300d
300 23 8 350 125 3900 17.4 79 1 cadillac eldorado
301 27.2 4 141 71 3190 24.8 79 2 peugeot 504
302 23.9 8 260 90 3420 22.2 79 1 oldsmobile cutlass salon brougham
303 34.2 4 105 70 2200 13.2 79 1 plymouth horizon
304 34.5 4 105 70 2150 14.9 79 1 plymouth horizon tc3
305 31.8 4 85 65 2020 19.2 79 3 datsun 210
306 37.3 4 91 69 2130 14.7 79 2 fiat strada custom
307 28.4 4 151 90 2670 16 79 1 buick skylark limited
308 28.8 6 173 115 2595 11.3 79 1 chevrolet citation
309 26.8 6 173 115 2700 12.9 79 1 oldsmobile omega brougham
310 33.5 4 151 90 2556 13.2 79 1 pontiac phoenix
311 41.5 4 98 76 2144 14.7 80 2 vw rabbit
312 38.1 4 89 60 1968 18.8 80 3 toyota corolla tercel
313 32.1 4 98 70 2120 15.5 80 1 chevrolet chevette
314 37.2 4 86 65 2019 16.4 80 3 datsun 310
315 28 4 151 90 2678 16.5 80 1 chevrolet citation
316 26.4 4 140 88 2870 18.1 80 1 ford fairmont
317 24.3 4 151 90 3003 20.1 80 1 amc concord
318 19.1 6 225 90 3381 18.7 80 1 dodge aspen
319 34.3 4 97 78 2188 15.8 80 2 audi 4000
320 29.8 4 134 90 2711 15.5 80 3 toyota corona liftback
321 31.3 4 120 75 2542 17.5 80 3 mazda 626
322 37 4 119 92 2434 15 80 3 datsun 510 hatchback
323 32.2 4 108 75 2265 15.2 80 3 toyota corolla
324 46.6 4 86 65 2110 17.9 80 3 mazda glc
325 27.9 4 156 105 2800 14.4 80 1 dodge colt
326 40.8 4 85 65 2110 19.2 80 3 datsun 210
327 44.3 4 90 48 2085 21.7 80 2 vw rabbit c (diesel)
328 43.4 4 90 48 2335 23.7 80 2 vw dasher (diesel)
329 36.4 5 121 67 2950 19.9 80 2 audi 5000s (diesel)
330 30 4 146 67 3250 21.8 80 2 mercedes-benz 240d
331 44.6 4 91 67 1850 13.8 80 3 honda civic 1500 gl
332 40.9 4 85 ? 1835 17.3 80 2 renault lecar deluxe
333 33.8 4 97 67 2145 18 80 3 subaru dl
334 29.8 4 89 62 1845 15.3 80 2 vokswagen rabbit
335 32.7 6 168 132 2910 11.4 80 3 datsun 280-zx
336 23.7 3 70 100 2420 12.5 80 3 mazda rx-7 gs
337 35 4 122 88 2500 15.1 80 2 triumph tr7 coupe
338 23.6 4 140 ? 2905 14.3 80 1 ford mustang cobra
339 32.4 4 107 72 2290 17 80 3 honda accord
340 27.2 4 135 84 2490 15.7 81 1 plymouth reliant
341 26.6 4 151 84 2635 16.4 81 1 buick skylark
342 25.8 4 156 92 2620 14.4 81 1 dodge aries wagon (sw)
343 23.5 6 173 110 2725 12.6 81 1 chevrolet citation
344 30 4 135 84 2385 12.9 81 1 plymouth reliant
345 39.1 4 79 58 1755 16.9 81 3 toyota starlet
346 39 4 86 64 1875 16.4 81 1 plymouth champ
347 35.1 4 81 60 1760 16.1 81 3 honda civic 1300
348 32.3 4 97 67 2065 17.8 81 3 subaru
349 37 4 85 65 1975 19.4 81 3 datsun 210 mpg
350 37.7 4 89 62 2050 17.3 81 3 toyota tercel
351 34.1 4 91 68 1985 16 81 3 mazda glc 4
352 34.7 4 105 63 2215 14.9 81 1 plymouth horizon 4
353 34.4 4 98 65 2045 16.2 81 1 ford escort 4w
354 29.9 4 98 65 2380 20.7 81 1 ford escort 2h
355 33 4 105 74 2190 14.2 81 2 volkswagen jetta
356 34.5 4 100 ? 2320 15.8 81 2 renault 18i
357 33.7 4 107 75 2210 14.4 81 3 honda prelude
358 32.4 4 108 75 2350 16.8 81 3 toyota corolla
359 32.9 4 119 100 2615 14.8 81 3 datsun 200sx
360 31.6 4 120 74 2635 18.3 81 3 mazda 626
361 28.1 4 141 80 3230 20.4 81 2 peugeot 505s turbo diesel
362 30.7 6 145 76 3160 19.6 81 2 volvo diesel
363 25.4 6 168 116 2900 12.6 81 3 toyota cressida
364 24.2 6 146 120 2930 13.8 81 3 datsun 810 maxima
365 22.4 6 231 110 3415 15.8 81 1 buick century
366 26.6 8 350 105 3725 19 81 1 oldsmobile cutlass ls
367 20.2 6 200 88 3060 17.1 81 1 ford granada gl
368 17.6 6 225 85 3465 16.6 81 1 chrysler lebaron salon
369 28 4 112 88 2605 19.6 82 1 chevrolet cavalier
370 27 4 112 88 2640 18.6 82 1 chevrolet cavalier wagon
371 34 4 112 88 2395 18 82 1 chevrolet cavalier 2-door
372 31 4 112 85 2575 16.2 82 1 pontiac j2000 se hatchback
373 29 4 135 84 2525 16 82 1 dodge aries se
374 27 4 151 90 2735 18 82 1 pontiac phoenix
375 24 4 140 92 2865 16.4 82 1 ford fairmont futura
376 23 4 151 ? 3035 20.5 82 1 amc concord dl
377 36 4 105 74 1980 15.3 82 2 volkswagen rabbit l
378 37 4 91 68 2025 18.2 82 3 mazda glc custom l
379 31 4 91 68 1970 17.6 82 3 mazda glc custom
380 38 4 105 63 2125 14.7 82 1 plymouth horizon miser
381 36 4 98 70 2125 17.3 82 1 mercury lynx l
382 36 4 120 88 2160 14.5 82 3 nissan stanza xe
383 36 4 107 75 2205 14.5 82 3 honda accord
384 34 4 108 70 2245 16.9 82 3 toyota corolla
385 38 4 91 67 1965 15 82 3 honda civic
386 32 4 91 67 1965 15.7 82 3 honda civic (auto)
387 38 4 91 67 1995 16.2 82 3 datsun 310 gx
388 25 6 181 110 2945 16.4 82 1 buick century limited
389 38 6 262 85 3015 17 82 1 oldsmobile cutlass ciera (diesel)
390 26 4 156 92 2585 14.5 82 1 chrysler lebaron medallion
391 22 6 232 112 2835 14.7 82 1 ford granada l
392 32 4 144 96 2665 13.9 82 3 toyota celica gt
393 36 4 135 84 2370 13 82 1 dodge charger 2.2
394 27 4 151 90 2950 17.3 82 1 chevrolet camaro
395 27 4 140 86 2790 15.6 82 1 ford mustang gl
396 44 4 97 52 2130 24.6 82 2 vw pickup
397 32 4 135 84 2295 11.6 82 1 dodge rampage
398 28 4 120 79 2625 18.6 82 1 ford ranger
399 31 4 119 82 2720 19.4 82 1 chevy s-10

Binary file not shown.

@ -0,0 +1,5 @@
a,b,c,d
0,1,2,3
4,5,6,7
8,9,10,11
12,13,14,15
1 a b c d
2 0 1 2 3
3 4 5 6 7
4 8 9 10 11
5 12 13 14 15

Binary file not shown.

@ -0,0 +1,5 @@
a,b,c,d
0,1,2,3
4,5,6,7
8,9,10,11
12,13,14,15
1 a b c d
2 0 1 2 3
3 4 5 6 7
4 8 9 10 11
5 12 13 14 15

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

@ -0,0 +1,78 @@
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>Country</th>
<th>200</th>
<th>2015</th>
<th>2030 Est.</th>
</tr>
</thead>
<tbody>
<tr>
<td>China[B]</td>
<td>1270</td>
<td>1376</td>
<td>1416</td>
</tr>
<tr>
<td>India</td>
<td>1053</td>
<td>1311</td>
<td>1528</td>
</tr>
<tr>
<td>United States</td>
<td>283</td>
<td>322</td>
<td>356</td>
</tr>
<tr>
<td>Indonesia</td>
<td>212</td>
<td>258</td>
<td>295</td>
</tr>
<tr>
<td>Pakistan</td>
<td>136</td>
<td>208</td>
<td>245</td>
</tr>
<tr>
<td>Brazil</td>
<td>176</td>
<td>206</td>
<td>228</td>
</tr>
<tr>
<td>Nigeria</td>
<td>123</td>
<td>182</td>
<td>263</td>
</tr>
<tr>
<td>Bangladesh</td>
<td>131</td>
<td>161</td>
<td>186</td>
</tr>
<tr>
<td>Russia</td>
<td>146</td>
<td>146</td>
<td>149</td>
</tr>
<tr>
<td>Mexico</td>
<td>103</td>
<td>127</td>
<td>148</td>
</tr>
<tr>
<td>World total</td>
<td>6127</td>
<td>7349</td>
<td>8501</td>
</tr>
</tbody>
</table>

@ -0,0 +1,36 @@
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
</tr>
<tr>
<td>8</td>
<td>9</td>
<td>10</td>
<td>11</td>
</tr>
<tr>
<td>12</td>
<td>13</td>
<td>14</td>
<td>15</td>
</tr>
</tbody>
</table>

@ -0,0 +1,245 @@
total_bill,tip,sex,smoker,day,time,size,price_per_person,Payer Name,CC Number,Payment ID
16.99,1.01,Female,No,Sun,Dinner,2,8.49,Christy Cunningham,3560325168603410,Sun2959
10.34,1.66,Male,No,Sun,Dinner,3,3.45,Douglas Tucker,4478071379779230,Sun4608
21.01,3.5,Male,No,Sun,Dinner,3,7.0,Travis Walters,6011812112971322,Sun4458
23.68,3.31,Male,No,Sun,Dinner,2,11.84,Nathaniel Harris,4676137647685994,Sun5260
24.59,3.61,Female,No,Sun,Dinner,4,6.15,Tonya Carter,4832732618637221,Sun2251
25.29,4.71,Male,No,Sun,Dinner,4,6.32,Erik Smith,213140353657882,Sun9679
8.77,2.0,Male,No,Sun,Dinner,2,4.38,Kristopher Johnson,2223727524230344,Sun5985
26.88,3.12,Male,No,Sun,Dinner,4,6.72,Robert Buck,3514785077705092,Sun8157
15.04,1.96,Male,No,Sun,Dinner,2,7.52,Joseph Mcdonald,3522866365840377,Sun6820
14.78,3.23,Male,No,Sun,Dinner,2,7.39,Jerome Abbott,3532124519049786,Sun3775
10.27,1.71,Male,No,Sun,Dinner,2,5.14,William Riley,566287581219,Sun2546
35.26,5.0,Female,No,Sun,Dinner,4,8.82,Diane Macias,4577817359320969,Sun6686
15.42,1.57,Male,No,Sun,Dinner,2,7.71,Chad Harrington,577040572932,Sun1300
18.43,3.0,Male,No,Sun,Dinner,4,4.61,Joshua Jones,6011163105616890,Sun2971
14.83,3.02,Female,No,Sun,Dinner,2,7.42,Vanessa Jones,30016702287574,Sun3848
21.58,3.92,Male,No,Sun,Dinner,2,10.79,Matthew Reilly,180073029785069,Sun1878
10.33,1.67,Female,No,Sun,Dinner,3,3.44,Elizabeth Foster,4240025044626033,Sun9715
16.29,3.71,Male,No,Sun,Dinner,3,5.43,John Pittman,6521340257218708,Sun2998
16.97,3.5,Female,No,Sun,Dinner,3,5.66,Laura Martinez,30422275171379,Sun2789
20.65,3.35,Male,No,Sat,Dinner,3,6.88,Timothy Oneal,6568069240986485,Sat9213
17.92,4.08,Male,No,Sat,Dinner,2,8.96,Thomas Rice,4403296224639756,Sat1709
20.29,2.75,Female,No,Sat,Dinner,2,10.14,Natalie Gardner,5448125351489749,Sat9618
15.77,2.23,Female,No,Sat,Dinner,2,7.88,Ashley Shelton,3524119516293213,Sat9786
39.42,7.58,Male,No,Sat,Dinner,4,9.86,Lance Peterson,3542584061609808,Sat239
19.82,3.18,Male,No,Sat,Dinner,2,9.91,Christopher Ross,36739148167928,Sat6236
17.81,2.34,Male,No,Sat,Dinner,4,4.45,Robert Perkins,30502930499388,Sat907
13.37,2.0,Male,No,Sat,Dinner,2,6.68,Kyle Avery,6531339539615499,Sat6651
12.69,2.0,Male,No,Sat,Dinner,2,6.34,Patrick Barber,30155551880343,Sat394
21.7,4.3,Male,No,Sat,Dinner,2,10.85,David Collier,5529694315416009,Sat3697
19.65,3.0,Female,No,Sat,Dinner,2,9.82,Melinda Murphy,5489272944576051,Sat2467
9.55,1.45,Male,No,Sat,Dinner,2,4.78,Grant Hall,30196517521548,Sat4099
18.35,2.5,Male,No,Sat,Dinner,4,4.59,Danny Santiago,630415546013,Sat4947
15.06,3.0,Female,No,Sat,Dinner,2,7.53,Amanda Wilson,213186304291560,Sat1327
20.69,2.45,Female,No,Sat,Dinner,4,5.17,Amber Francis,377742985258914,Sat6649
17.78,3.27,Male,No,Sat,Dinner,2,8.89,Jacob Castillo,3551492000704805,Sat8124
24.06,3.6,Male,No,Sat,Dinner,3,8.02,Joseph Mullins,5519770449260299,Sat632
16.31,2.0,Male,No,Sat,Dinner,3,5.44,William Ford,3527691170179398,Sat9139
16.93,3.07,Female,No,Sat,Dinner,3,5.64,Erin Lewis,5161695527390786,Sat6406
18.69,2.31,Male,No,Sat,Dinner,3,6.23,Brandon Bradley,4427601595688633,Sat4056
31.27,5.0,Male,No,Sat,Dinner,3,10.42,Mr. Brandon Berry,6011525851069856,Sat6373
16.04,2.24,Male,No,Sat,Dinner,3,5.35,Adam Edwards,3544447755679420,Sat8549
17.46,2.54,Male,No,Sun,Dinner,2,8.73,David Boyer,3536678244278149,Sun9460
13.94,3.06,Male,No,Sun,Dinner,2,6.97,Bryan Brown,36231182760859,Sun1699
9.68,1.32,Male,No,Sun,Dinner,2,4.84,Christopher Spears,4387671121369212,Sun3279
30.4,5.6,Male,No,Sun,Dinner,4,7.6,Todd Cooper,503846761263,Sun2274
18.29,3.0,Male,No,Sun,Dinner,2,9.14,Richard Fitzgerald,375156610762053,Sun8643
22.23,5.0,Male,No,Sun,Dinner,2,11.12,Joshua Gilmore,4292072734899,Sun7097
32.4,6.0,Male,No,Sun,Dinner,4,8.1,James Barnes,3552002592874186,Sun9677
28.55,2.05,Male,No,Sun,Dinner,3,9.52,Austin Fisher,6011481668986587,Sun4142
18.04,3.0,Male,No,Sun,Dinner,2,9.02,William Roth,6573923967142503,Sun9774
12.54,2.5,Male,No,Sun,Dinner,2,6.27,Jeremiah Neal,2225400829691416,Sun2021
10.29,2.6,Female,No,Sun,Dinner,2,5.14,Jessica Ibarra,4999759463713,Sun4474
34.81,5.2,Female,No,Sun,Dinner,4,8.7,Emily Daniel,4291280793094374,Sun6165
9.94,1.56,Male,No,Sun,Dinner,2,4.97,Curtis Morgan,4628628020417301,Sun4561
25.56,4.34,Male,No,Sun,Dinner,4,6.39,Ronald Owens,6569607991983380,Sun9470
19.49,3.51,Male,No,Sun,Dinner,2,9.74,Michael Hamilton,6502227786581768,Sun1118
38.01,3.0,Male,Yes,Sat,Dinner,4,9.5,James Christensen DDS,349793629453226,Sat8903
26.41,1.5,Female,No,Sat,Dinner,2,13.2,Melody Simon,4745394421258160,Sat8980
11.24,1.76,Male,Yes,Sat,Dinner,2,5.62,Troy Guerrero,3560782621035582,Sat6683
48.27,6.73,Male,No,Sat,Dinner,4,12.07,Brian Ortiz,6596453823950595,Sat8139
20.29,3.21,Male,Yes,Sat,Dinner,2,10.14,Anthony Mclean,347614304015027,Sat2353
13.81,2.0,Male,Yes,Sat,Dinner,2,6.9,Ryan Hernandez,4766834726806,Sat3030
11.02,1.98,Male,Yes,Sat,Dinner,2,5.51,Joseph Hart,180046232326178,Sat2265
18.29,3.76,Male,Yes,Sat,Dinner,4,4.57,Chad Hart,580171498976,Sat4178
17.59,2.64,Male,No,Sat,Dinner,3,5.86,Michael Johnson,2222114458088108,Sat1667
20.08,3.15,Male,No,Sat,Dinner,3,6.69,Justin Dixon,180021262464926,Sat6840
16.45,2.47,Female,No,Sat,Dinner,2,8.22,Rachel Vaughn,3569262692675583,Sat4750
3.07,1.0,Female,Yes,Sat,Dinner,1,3.07,Tiffany Brock,4359488526995267,Sat3455
20.23,2.01,Male,No,Sat,Dinner,2,10.12,Mr. Travis Bailey Jr.,060406789937,Sat561
15.01,2.09,Male,Yes,Sat,Dinner,2,7.5,Adam Hall,4700924377057571,Sat855
12.02,1.97,Male,No,Sat,Dinner,2,6.01,Max Brown,213139760497718,Sat2100
17.07,3.0,Female,No,Sat,Dinner,3,5.69,Teresa Fisher,5442222963796367,Sat3469
26.86,3.14,Female,Yes,Sat,Dinner,2,13.43,Victoria Obrien MD,4216245673726,Sat1967
25.28,5.0,Female,Yes,Sat,Dinner,2,12.64,Julie Holmes,5418689346409571,Sat6065
14.73,2.2,Female,No,Sat,Dinner,2,7.36,Ashley Harris,501828723483,Sat6548
10.51,1.25,Male,No,Sat,Dinner,2,5.26,Kenneth Hayes,213142079731108,Sat5056
17.92,3.08,Male,Yes,Sat,Dinner,2,8.96,Mark Smith,676188485350,Sat9908
27.2,4.0,Male,No,Thur,Lunch,4,6.8,John Davis,30344778738589,Thur4924
22.76,3.0,Male,No,Thur,Lunch,2,11.38,Chris Hahn,3591887177014031,Thur2863
17.29,2.71,Male,No,Thur,Lunch,2,8.64,Brian Diaz,4759290988169738,Thur9501
19.44,3.0,Male,Yes,Thur,Lunch,2,9.72,Louis Torres,38848369968464,Thur6453
16.66,3.4,Male,No,Thur,Lunch,2,8.33,William Martin,4550549048402707,Thur8232
10.07,1.83,Female,No,Thur,Lunch,1,10.07,Julie Moody,630413282843,Thur4909
32.68,5.0,Male,Yes,Thur,Lunch,2,16.34,Daniel Murphy,5356177501009133,Thur8801
15.98,2.03,Male,No,Thur,Lunch,2,7.99,Jason Jones,4442984204923315,Thur1944
34.83,5.17,Female,No,Thur,Lunch,4,8.71,Shawna Cook,6011787464177340,Thur7972
13.03,2.0,Male,No,Thur,Lunch,2,6.52,Derek Thomas,213161022097557,Thur6793
18.28,4.0,Male,No,Thur,Lunch,2,9.14,Donald Williams,5363745772301404,Thur3636
24.71,5.85,Male,No,Thur,Lunch,2,12.36,Roger Taylor,4410248629955,Thur9003
21.16,3.0,Male,No,Thur,Lunch,2,10.58,Keith Lewis,4356005144080422,Thur6273
28.97,3.0,Male,Yes,Fri,Dinner,2,14.48,Daniel Mason,3597456900644078,Fri4175
22.49,3.5,Male,No,Fri,Dinner,2,11.24,Earl Horn,6011849326227398,Fri5700
5.75,1.0,Female,Yes,Fri,Dinner,2,2.88,Leah Ramirez,3508911676966392,Fri3780
16.32,4.3,Female,Yes,Fri,Dinner,2,8.16,Natalie Nguyen,5181236182893396,Fri6963
22.75,3.25,Female,No,Fri,Dinner,2,11.38,Jamie Garza,676318332068,Fri2318
40.17,4.73,Male,Yes,Fri,Dinner,4,10.04,Aaron Bentley,180026611638690,Fri9628
27.28,4.0,Male,Yes,Fri,Dinner,2,13.64,Eric Carter,4563054452787961,Fri3159
12.03,1.5,Male,Yes,Fri,Dinner,2,6.02,Eric Herrera,580116092652,Fri9268
21.01,3.0,Male,Yes,Fri,Dinner,2,10.5,Michael Li,4831801127457917,Fri144
12.46,1.5,Male,No,Fri,Dinner,2,6.23,Edward Carter,347435564751626,Fri5575
11.35,2.5,Female,Yes,Fri,Dinner,2,5.68,Lori Lynch,38558279384492,Fri4106
15.38,3.0,Female,Yes,Fri,Dinner,2,7.69,Tiffany Colon,6011012799432041,Fri8382
44.3,2.5,Female,Yes,Sat,Dinner,3,14.77,Heather Cohen,379771118886604,Sat6240
22.42,3.48,Female,Yes,Sat,Dinner,2,11.21,Kathleen Hawkins,348009865484721,Sat1015
20.92,4.08,Female,No,Sat,Dinner,2,10.46,Gabrielle Frederick,4013010878990106,Sat3194
15.36,1.64,Male,Yes,Sat,Dinner,2,7.68,David Price,4029957452720,Sat5106
20.49,4.06,Male,Yes,Sat,Dinner,2,10.24,Karl Mcdaniel,180024452771522,Sat7865
25.21,4.29,Male,Yes,Sat,Dinner,2,12.6,Jason Mullen,4738781782868,Sat5196
18.24,3.76,Male,No,Sat,Dinner,2,9.12,Steven Grant,4112810433473856,Sat6376
14.31,4.0,Female,Yes,Sat,Dinner,2,7.16,Amanda Anderson,375638820334211,Sat2614
14.0,3.0,Male,No,Sat,Dinner,2,7.0,James Sanchez,345243048851323,Sat6801
7.25,1.0,Female,No,Sat,Dinner,1,7.25,Terri Jones,3559221007826887,Sat4801
38.07,4.0,Male,No,Sun,Dinner,3,12.69,Jeff Lopez,3572865915176463,Sun591
23.95,2.55,Male,No,Sun,Dinner,2,11.98,John Joyce,6565964211060570,Sun1885
25.71,4.0,Female,No,Sun,Dinner,3,8.57,Katie Smith,5400160161311292,Sun6492
17.31,3.5,Female,No,Sun,Dinner,2,8.65,Kayla Stone,379494319310858,Sun8746
29.93,5.07,Male,No,Sun,Dinner,4,7.48,Shawn Blake,4689079711213722,Sun22
10.65,1.5,Female,No,Thur,Lunch,2,5.32,Linda Zhang,3560509622598239,Thur9593
12.43,1.8,Female,No,Thur,Lunch,2,6.22,Dr. Caroline Tucker,502047186908,Thur8084
24.08,2.92,Female,No,Thur,Lunch,4,6.02,Melanie Jordan,676212062720,Thur8063
11.69,2.31,Male,No,Thur,Lunch,2,5.84,Kenneth Goodman,4891259691010,Thur8289
13.42,1.68,Female,No,Thur,Lunch,2,6.71,Laura Garcia,5181484390945653,Thur2158
14.26,2.5,Male,No,Thur,Lunch,2,7.13,Perry Garcia,180034646320219,Thur3579
15.95,2.0,Male,No,Thur,Lunch,2,7.98,Christopher Lang,4820629318698319,Thur1992
12.48,2.52,Female,No,Thur,Lunch,2,6.24,Jordan Diaz,4472778228206399,Thur208
29.8,4.2,Female,No,Thur,Lunch,6,4.97,Angela Sanchez,503857080488,Thur3948
8.52,1.48,Male,No,Thur,Lunch,2,4.26,Mario Bradshaw,4524404353861811,Thur6719
14.52,2.0,Female,No,Thur,Lunch,2,7.26,Jessica Simmons,213102478792200,Thur1512
11.38,2.0,Female,No,Thur,Lunch,2,5.69,Christine Perkins,3548391118913991,Thur8551
22.82,2.18,Male,No,Thur,Lunch,3,7.61,Raymond Torres,4855776744024,Thur9424
19.08,1.5,Male,No,Thur,Lunch,2,9.54,Seth Sexton,213113680829581,Thur1446
20.27,2.83,Female,No,Thur,Lunch,2,10.14,Ashley Burke,5394652998970066,Thur9005
11.17,1.5,Female,No,Thur,Lunch,2,5.58,Taylor Gonzalez,6011990685390011,Thur7783
12.26,2.0,Female,No,Thur,Lunch,2,6.13,Kaitlin Wolf,676348318145,Thur1561
18.26,3.25,Female,No,Thur,Lunch,2,9.13,Karen Rodriguez,4952604748911,Thur75
8.51,1.25,Female,No,Thur,Lunch,2,4.26,Rebecca Harris,4320272020376174,Thur6600
10.33,2.0,Female,No,Thur,Lunch,2,5.16,Donna Kelly,180048553626376,Thur1393
14.15,2.0,Female,No,Thur,Lunch,2,7.08,Vanessa Morris,213189344156819,Thur3890
16.0,2.0,Male,Yes,Thur,Lunch,2,8.0,Jason Burgess,3561461821942363,Thur2710
13.16,2.75,Female,No,Thur,Lunch,2,6.58,Lindsey Meyer,676239597203,Thur6245
17.47,3.5,Female,No,Thur,Lunch,2,8.74,Kayla Rios,5233918213804470,Thur3906
34.3,6.7,Male,No,Thur,Lunch,6,5.72,Steven Carlson,3526515703718508,Thur1025
41.19,5.0,Male,No,Thur,Lunch,5,8.24,Eric Andrews,4356531761046453,Thur3621
27.05,5.0,Female,No,Thur,Lunch,6,4.51,Regina Jones,4311048695487,Thur6179
16.43,2.3,Female,No,Thur,Lunch,2,8.22,Linda Jones,6542729219645658,Thur9002
8.35,1.5,Female,No,Thur,Lunch,2,4.18,Amy Young,4285454264477,Thur9331
18.64,1.36,Female,No,Thur,Lunch,3,6.21,Kelly Estrada,060463302327,Thur3941
11.87,1.63,Female,No,Thur,Lunch,2,5.94,Annette Cunningham,675937746864,Thur4780
9.78,1.73,Male,No,Thur,Lunch,2,4.89,David Stewart,3578014604116399,Thur7276
7.51,2.0,Male,No,Thur,Lunch,2,3.76,Daniel Robbins,4823139288341889,Thur6321
14.07,2.5,Male,No,Sun,Dinner,2,7.04,Luke Rice,4813617017359506,Sun8863
13.13,2.0,Male,No,Sun,Dinner,2,6.56,Jason Arnold,3571825125296106,Sun2127
17.26,2.74,Male,No,Sun,Dinner,3,5.75,Gregory Smith,4292362333741,Sun5205
24.55,2.0,Male,No,Sun,Dinner,4,6.14,Todd Patterson,4416804908942159,Sun8670
19.77,2.0,Male,No,Sun,Dinner,4,4.94,James Smith,213169731428229,Sun5814
29.85,5.14,Female,No,Sun,Dinner,5,5.97,Madison Wilson,4210875236164664,Sun9176
48.17,5.0,Male,No,Sun,Dinner,6,8.03,Ryan Gonzales,3523151482063321,Sun7518
25.0,3.75,Female,No,Sun,Dinner,4,6.25,Laura Robles,213158685144262,Sun7015
13.39,2.61,Female,No,Sun,Dinner,2,6.7,Ashley Boyd,3571088058115021,Sun982
16.49,2.0,Male,No,Sun,Dinner,4,4.12,Christopher Soto,30501814271434,Sun1781
21.5,3.5,Male,No,Sun,Dinner,4,5.38,Travis Gonzalez,3527668419764685,Sun245
12.66,2.5,Male,No,Sun,Dinner,2,6.33,Brandon Oconnor,4406882156920533,Sun5879
16.21,2.0,Female,No,Sun,Dinner,3,5.4,Jennifer Baird,4227834176859693,Sun5521
13.81,2.0,Male,No,Sun,Dinner,2,6.9,Charles Newton,5552793481414044,Sun8594
17.51,3.0,Female,Yes,Sun,Dinner,2,8.76,Audrey Griffin,3500853929693258,Sun444
24.52,3.48,Male,No,Sun,Dinner,3,8.17,Jacob Hansen,4031116007387,Sun9043
20.76,2.24,Male,No,Sun,Dinner,2,10.38,Gordon Lane,4110599849536479,Sun6738
31.71,4.5,Male,No,Sun,Dinner,4,7.93,Michael Lawson,3566285921227119,Sun3719
10.59,1.61,Female,Yes,Sat,Dinner,2,5.3,Sara Jimenez,502053147208,Sat9795
10.63,2.0,Female,Yes,Sat,Dinner,2,5.32,Amy Hill,3536332481454019,Sat1788
50.81,10.0,Male,Yes,Sat,Dinner,3,16.94,Gregory Clark,5473850968388236,Sat1954
15.81,3.16,Male,Yes,Sat,Dinner,2,7.9,David Hall,502004138207,Sat6750
7.25,5.15,Male,Yes,Sun,Dinner,2,3.62,Larry White,30432617123103,Sun9209
31.85,3.18,Male,Yes,Sun,Dinner,2,15.92,Scott Perez,3577115550328507,Sun9335
16.82,4.0,Male,Yes,Sun,Dinner,2,8.41,Brian Miles,3586342145399277,Sun7621
32.9,3.11,Male,Yes,Sun,Dinner,2,16.45,Nathan Reynolds,370307040837149,Sun5109
17.89,2.0,Male,Yes,Sun,Dinner,2,8.94,Walter Simmons,6011481578696110,Sun5961
14.48,2.0,Male,Yes,Sun,Dinner,2,7.24,John Dudley,4565183162071073,Sun6203
9.6,4.0,Female,Yes,Sun,Dinner,2,4.8,Melanie Gray,4211808859168,Sun4598
34.63,3.55,Male,Yes,Sun,Dinner,2,17.32,Brian Bailey,346656312114848,Sun9851
34.65,3.68,Male,Yes,Sun,Dinner,4,8.66,James Hebert DDS,676168737648,Sun7544
23.33,5.65,Male,Yes,Sun,Dinner,2,11.66,Jason Cox,6556931703586223,Sun3402
45.35,3.5,Male,Yes,Sun,Dinner,3,15.12,Jose Parsons,4112207559459910,Sun2337
23.17,6.5,Male,Yes,Sun,Dinner,4,5.79,Dr. Michael James,4718501859162,Sun6059
40.55,3.0,Male,Yes,Sun,Dinner,2,20.27,Stephen Cox,3547798222044029,Sun5140
20.69,5.0,Male,No,Sun,Dinner,5,4.14,Joseph Howell,30362407455623,Sun5842
20.9,3.5,Female,Yes,Sun,Dinner,3,6.97,Heidi Atkinson,4422858423131187,Sun4254
30.46,2.0,Male,Yes,Sun,Dinner,5,6.09,David Barrett,4792882899700988,Sun9987
18.15,3.5,Female,Yes,Sun,Dinner,3,6.05,Glenda Wiggins,578329325307,Sun430
23.1,4.0,Male,Yes,Sun,Dinner,3,7.7,Richard Stevens,3560193117506187,Sun1821
15.69,1.5,Male,Yes,Sun,Dinner,2,7.84,Riley Barnes,180053549128800,Sun5104
19.81,4.19,Female,Yes,Thur,Lunch,2,9.9,Kristy Boyd,4317015327600068,Thur967
28.44,2.56,Male,Yes,Thur,Lunch,2,14.22,Dr. Jeffrey Rich,4737538358295,Thur4334
15.48,2.02,Male,Yes,Thur,Lunch,2,7.74,Raymond Sullivan,180068856139315,Thur606
16.58,4.0,Male,Yes,Thur,Lunch,2,8.29,Benjamin Weber,676210011505,Thur9318
7.56,1.44,Male,No,Thur,Lunch,2,3.78,Michael White,4865390263095532,Thur697
10.34,2.0,Male,Yes,Thur,Lunch,2,5.17,Eric Martin,30442491190342,Thur9862
43.11,5.0,Female,Yes,Thur,Lunch,4,10.78,Brooke Soto,5544902205760175,Thur9313
13.0,2.0,Female,Yes,Thur,Lunch,2,6.5,Katherine Bond,4926725945192,Thur437
13.51,2.0,Male,Yes,Thur,Lunch,2,6.76,Joseph Murphy MD,6547218923471275,Thur2428
18.71,4.0,Male,Yes,Thur,Lunch,3,6.24,Jason Conrad,4581233003487,Thur6048
12.74,2.01,Female,Yes,Thur,Lunch,2,6.37,Abigail Parks,3586645396220590,Thur2544
13.0,2.0,Female,Yes,Thur,Lunch,2,6.5,Ashley Shaw,180088043008041,Thur1301
16.4,2.5,Female,Yes,Thur,Lunch,2,8.2,Toni Brooks,3582289985920239,Thur7770
20.53,4.0,Male,Yes,Thur,Lunch,4,5.13,Scott Kim,3570611756827620,Thur2160
16.47,3.23,Female,Yes,Thur,Lunch,3,5.49,Carly Reyes,4787787236486,Thur8084
26.59,3.41,Male,Yes,Sat,Dinner,3,8.86,Daniel Owens,38971087967574,Sat1
38.73,3.0,Male,Yes,Sat,Dinner,4,9.68,Ricky Ramirez,347817964484033,Sat4505
24.27,2.03,Male,Yes,Sat,Dinner,2,12.14,Jason Carter,4268942915626180,Sat6048
12.76,2.23,Female,Yes,Sat,Dinner,2,6.38,Sarah Cunningham,341876516331163,Sat1274
30.06,2.0,Male,Yes,Sat,Dinner,3,10.02,Shawn Mendoza,30184049218122,Sat8361
25.89,5.16,Male,Yes,Sat,Dinner,4,6.47,Christopher Li,6011962464150569,Sat6735
48.33,9.0,Male,No,Sat,Dinner,4,12.08,Alex Williamson,676218815212,Sat4590
13.27,2.5,Female,Yes,Sat,Dinner,2,6.64,Robin Andersen,580140531089,Sat1374
28.17,6.5,Female,Yes,Sat,Dinner,3,9.39,Marissa Jackson,4922302538691962,Sat3374
12.9,1.1,Female,Yes,Sat,Dinner,2,6.45,Jessica Owen,4726904879471,Sat6983
28.15,3.0,Male,Yes,Sat,Dinner,5,5.63,Shawn Barnett PhD,4590982568244,Sat7320
11.59,1.5,Male,Yes,Sat,Dinner,2,5.8,Gary Orr,30324521283406,Sat8489
7.74,1.44,Male,Yes,Sat,Dinner,2,3.87,Nicholas Archer,340517153733524,Sat4772
30.14,3.09,Female,Yes,Sat,Dinner,4,7.54,Shelby House,502097403252,Sat8863
12.16,2.2,Male,Yes,Fri,Lunch,2,6.08,Ricky Johnson,213109508670736,Fri4607
13.42,3.48,Female,Yes,Fri,Lunch,2,6.71,Leslie Kaufman,379437981958785,Fri7511
8.58,1.92,Male,Yes,Fri,Lunch,1,8.58,Jason Lawrence,3505302934650403,Fri6624
15.98,3.0,Female,No,Fri,Lunch,3,5.33,Mary Rivera,5343428579353069,Fri6014
13.42,1.58,Male,Yes,Fri,Lunch,2,6.71,Ronald Vaughn DVM,341503466406403,Fri5959
16.27,2.5,Female,Yes,Fri,Lunch,2,8.14,Whitney Arnold,3579111947217428,Fri6665
10.09,2.0,Female,Yes,Fri,Lunch,2,5.04,Ruth Weiss,5268689490381635,Fri6359
20.45,3.0,Male,No,Sat,Dinner,4,5.11,Robert Bradley,213141668145910,Sat4319
13.28,2.72,Male,No,Sat,Dinner,2,6.64,Glenn Jones,502061651712,Sat2937
22.12,2.88,Female,Yes,Sat,Dinner,2,11.06,Jennifer Russell,4793003293608,Sat3943
24.01,2.0,Male,Yes,Sat,Dinner,4,6.0,Michael Osborne,4258682154026,Sat7872
15.69,3.0,Male,Yes,Sat,Dinner,3,5.23,Jason Parks,4812333796161,Sat6334
11.61,3.39,Male,No,Sat,Dinner,2,5.8,James Taylor,6011482917327995,Sat2124
10.77,1.47,Male,No,Sat,Dinner,2,5.38,Paul Novak,6011698897610858,Sat1467
15.53,3.0,Male,Yes,Sat,Dinner,2,7.76,Tracy Douglas,4097938155941930,Sat7220
10.07,1.25,Male,No,Sat,Dinner,2,5.04,Sean Gonzalez,3534021246117605,Sat4615
12.6,1.0,Male,Yes,Sat,Dinner,2,6.3,Matthew Myers,3543676378973965,Sat5032
32.83,1.17,Male,Yes,Sat,Dinner,2,16.42,Thomas Brown,4284722681265508,Sat2929
35.83,4.67,Female,No,Sat,Dinner,3,11.94,Kimberly Crane,676184013727,Sat9777
29.03,5.92,Male,No,Sat,Dinner,3,9.68,Michael Avila,5296068606052842,Sat2657
27.18,2.0,Female,Yes,Sat,Dinner,2,13.59,Monica Sanders,3506806155565404,Sat1766
22.67,2.0,Male,Yes,Sat,Dinner,2,11.34,Keith Wong,6011891618747196,Sat3880
17.82,1.75,Male,No,Sat,Dinner,2,8.91,Dennis Dixon,4375220550950,Sat17
18.78,3.0,Female,No,Thur,Dinner,2,9.39,Michelle Hardin,3511451626698139,Thur672
1 total_bill tip sex smoker day time size price_per_person Payer Name CC Number Payment ID
2 16.99 1.01 Female No Sun Dinner 2 8.49 Christy Cunningham 3560325168603410 Sun2959
3 10.34 1.66 Male No Sun Dinner 3 3.45 Douglas Tucker 4478071379779230 Sun4608
4 21.01 3.5 Male No Sun Dinner 3 7.0 Travis Walters 6011812112971322 Sun4458
5 23.68 3.31 Male No Sun Dinner 2 11.84 Nathaniel Harris 4676137647685994 Sun5260
6 24.59 3.61 Female No Sun Dinner 4 6.15 Tonya Carter 4832732618637221 Sun2251
7 25.29 4.71 Male No Sun Dinner 4 6.32 Erik Smith 213140353657882 Sun9679
8 8.77 2.0 Male No Sun Dinner 2 4.38 Kristopher Johnson 2223727524230344 Sun5985
9 26.88 3.12 Male No Sun Dinner 4 6.72 Robert Buck 3514785077705092 Sun8157
10 15.04 1.96 Male No Sun Dinner 2 7.52 Joseph Mcdonald 3522866365840377 Sun6820
11 14.78 3.23 Male No Sun Dinner 2 7.39 Jerome Abbott 3532124519049786 Sun3775
12 10.27 1.71 Male No Sun Dinner 2 5.14 William Riley 566287581219 Sun2546
13 35.26 5.0 Female No Sun Dinner 4 8.82 Diane Macias 4577817359320969 Sun6686
14 15.42 1.57 Male No Sun Dinner 2 7.71 Chad Harrington 577040572932 Sun1300
15 18.43 3.0 Male No Sun Dinner 4 4.61 Joshua Jones 6011163105616890 Sun2971
16 14.83 3.02 Female No Sun Dinner 2 7.42 Vanessa Jones 30016702287574 Sun3848
17 21.58 3.92 Male No Sun Dinner 2 10.79 Matthew Reilly 180073029785069 Sun1878
18 10.33 1.67 Female No Sun Dinner 3 3.44 Elizabeth Foster 4240025044626033 Sun9715
19 16.29 3.71 Male No Sun Dinner 3 5.43 John Pittman 6521340257218708 Sun2998
20 16.97 3.5 Female No Sun Dinner 3 5.66 Laura Martinez 30422275171379 Sun2789
21 20.65 3.35 Male No Sat Dinner 3 6.88 Timothy Oneal 6568069240986485 Sat9213
22 17.92 4.08 Male No Sat Dinner 2 8.96 Thomas Rice 4403296224639756 Sat1709
23 20.29 2.75 Female No Sat Dinner 2 10.14 Natalie Gardner 5448125351489749 Sat9618
24 15.77 2.23 Female No Sat Dinner 2 7.88 Ashley Shelton 3524119516293213 Sat9786
25 39.42 7.58 Male No Sat Dinner 4 9.86 Lance Peterson 3542584061609808 Sat239
26 19.82 3.18 Male No Sat Dinner 2 9.91 Christopher Ross 36739148167928 Sat6236
27 17.81 2.34 Male No Sat Dinner 4 4.45 Robert Perkins 30502930499388 Sat907
28 13.37 2.0 Male No Sat Dinner 2 6.68 Kyle Avery 6531339539615499 Sat6651
29 12.69 2.0 Male No Sat Dinner 2 6.34 Patrick Barber 30155551880343 Sat394
30 21.7 4.3 Male No Sat Dinner 2 10.85 David Collier 5529694315416009 Sat3697
31 19.65 3.0 Female No Sat Dinner 2 9.82 Melinda Murphy 5489272944576051 Sat2467
32 9.55 1.45 Male No Sat Dinner 2 4.78 Grant Hall 30196517521548 Sat4099
33 18.35 2.5 Male No Sat Dinner 4 4.59 Danny Santiago 630415546013 Sat4947
34 15.06 3.0 Female No Sat Dinner 2 7.53 Amanda Wilson 213186304291560 Sat1327
35 20.69 2.45 Female No Sat Dinner 4 5.17 Amber Francis 377742985258914 Sat6649
36 17.78 3.27 Male No Sat Dinner 2 8.89 Jacob Castillo 3551492000704805 Sat8124
37 24.06 3.6 Male No Sat Dinner 3 8.02 Joseph Mullins 5519770449260299 Sat632
38 16.31 2.0 Male No Sat Dinner 3 5.44 William Ford 3527691170179398 Sat9139
39 16.93 3.07 Female No Sat Dinner 3 5.64 Erin Lewis 5161695527390786 Sat6406
40 18.69 2.31 Male No Sat Dinner 3 6.23 Brandon Bradley 4427601595688633 Sat4056
41 31.27 5.0 Male No Sat Dinner 3 10.42 Mr. Brandon Berry 6011525851069856 Sat6373
42 16.04 2.24 Male No Sat Dinner 3 5.35 Adam Edwards 3544447755679420 Sat8549
43 17.46 2.54 Male No Sun Dinner 2 8.73 David Boyer 3536678244278149 Sun9460
44 13.94 3.06 Male No Sun Dinner 2 6.97 Bryan Brown 36231182760859 Sun1699
45 9.68 1.32 Male No Sun Dinner 2 4.84 Christopher Spears 4387671121369212 Sun3279
46 30.4 5.6 Male No Sun Dinner 4 7.6 Todd Cooper 503846761263 Sun2274
47 18.29 3.0 Male No Sun Dinner 2 9.14 Richard Fitzgerald 375156610762053 Sun8643
48 22.23 5.0 Male No Sun Dinner 2 11.12 Joshua Gilmore 4292072734899 Sun7097
49 32.4 6.0 Male No Sun Dinner 4 8.1 James Barnes 3552002592874186 Sun9677
50 28.55 2.05 Male No Sun Dinner 3 9.52 Austin Fisher 6011481668986587 Sun4142
51 18.04 3.0 Male No Sun Dinner 2 9.02 William Roth 6573923967142503 Sun9774
52 12.54 2.5 Male No Sun Dinner 2 6.27 Jeremiah Neal 2225400829691416 Sun2021
53 10.29 2.6 Female No Sun Dinner 2 5.14 Jessica Ibarra 4999759463713 Sun4474
54 34.81 5.2 Female No Sun Dinner 4 8.7 Emily Daniel 4291280793094374 Sun6165
55 9.94 1.56 Male No Sun Dinner 2 4.97 Curtis Morgan 4628628020417301 Sun4561
56 25.56 4.34 Male No Sun Dinner 4 6.39 Ronald Owens 6569607991983380 Sun9470
57 19.49 3.51 Male No Sun Dinner 2 9.74 Michael Hamilton 6502227786581768 Sun1118
58 38.01 3.0 Male Yes Sat Dinner 4 9.5 James Christensen DDS 349793629453226 Sat8903
59 26.41 1.5 Female No Sat Dinner 2 13.2 Melody Simon 4745394421258160 Sat8980
60 11.24 1.76 Male Yes Sat Dinner 2 5.62 Troy Guerrero 3560782621035582 Sat6683
61 48.27 6.73 Male No Sat Dinner 4 12.07 Brian Ortiz 6596453823950595 Sat8139
62 20.29 3.21 Male Yes Sat Dinner 2 10.14 Anthony Mclean 347614304015027 Sat2353
63 13.81 2.0 Male Yes Sat Dinner 2 6.9 Ryan Hernandez 4766834726806 Sat3030
64 11.02 1.98 Male Yes Sat Dinner 2 5.51 Joseph Hart 180046232326178 Sat2265
65 18.29 3.76 Male Yes Sat Dinner 4 4.57 Chad Hart 580171498976 Sat4178
66 17.59 2.64 Male No Sat Dinner 3 5.86 Michael Johnson 2222114458088108 Sat1667
67 20.08 3.15 Male No Sat Dinner 3 6.69 Justin Dixon 180021262464926 Sat6840
68 16.45 2.47 Female No Sat Dinner 2 8.22 Rachel Vaughn 3569262692675583 Sat4750
69 3.07 1.0 Female Yes Sat Dinner 1 3.07 Tiffany Brock 4359488526995267 Sat3455
70 20.23 2.01 Male No Sat Dinner 2 10.12 Mr. Travis Bailey Jr. 060406789937 Sat561
71 15.01 2.09 Male Yes Sat Dinner 2 7.5 Adam Hall 4700924377057571 Sat855
72 12.02 1.97 Male No Sat Dinner 2 6.01 Max Brown 213139760497718 Sat2100
73 17.07 3.0 Female No Sat Dinner 3 5.69 Teresa Fisher 5442222963796367 Sat3469
74 26.86 3.14 Female Yes Sat Dinner 2 13.43 Victoria Obrien MD 4216245673726 Sat1967
75 25.28 5.0 Female Yes Sat Dinner 2 12.64 Julie Holmes 5418689346409571 Sat6065
76 14.73 2.2 Female No Sat Dinner 2 7.36 Ashley Harris 501828723483 Sat6548
77 10.51 1.25 Male No Sat Dinner 2 5.26 Kenneth Hayes 213142079731108 Sat5056
78 17.92 3.08 Male Yes Sat Dinner 2 8.96 Mark Smith 676188485350 Sat9908
79 27.2 4.0 Male No Thur Lunch 4 6.8 John Davis 30344778738589 Thur4924
80 22.76 3.0 Male No Thur Lunch 2 11.38 Chris Hahn 3591887177014031 Thur2863
81 17.29 2.71 Male No Thur Lunch 2 8.64 Brian Diaz 4759290988169738 Thur9501
82 19.44 3.0 Male Yes Thur Lunch 2 9.72 Louis Torres 38848369968464 Thur6453
83 16.66 3.4 Male No Thur Lunch 2 8.33 William Martin 4550549048402707 Thur8232
84 10.07 1.83 Female No Thur Lunch 1 10.07 Julie Moody 630413282843 Thur4909
85 32.68 5.0 Male Yes Thur Lunch 2 16.34 Daniel Murphy 5356177501009133 Thur8801
86 15.98 2.03 Male No Thur Lunch 2 7.99 Jason Jones 4442984204923315 Thur1944
87 34.83 5.17 Female No Thur Lunch 4 8.71 Shawna Cook 6011787464177340 Thur7972
88 13.03 2.0 Male No Thur Lunch 2 6.52 Derek Thomas 213161022097557 Thur6793
89 18.28 4.0 Male No Thur Lunch 2 9.14 Donald Williams 5363745772301404 Thur3636
90 24.71 5.85 Male No Thur Lunch 2 12.36 Roger Taylor 4410248629955 Thur9003
91 21.16 3.0 Male No Thur Lunch 2 10.58 Keith Lewis 4356005144080422 Thur6273
92 28.97 3.0 Male Yes Fri Dinner 2 14.48 Daniel Mason 3597456900644078 Fri4175
93 22.49 3.5 Male No Fri Dinner 2 11.24 Earl Horn 6011849326227398 Fri5700
94 5.75 1.0 Female Yes Fri Dinner 2 2.88 Leah Ramirez 3508911676966392 Fri3780
95 16.32 4.3 Female Yes Fri Dinner 2 8.16 Natalie Nguyen 5181236182893396 Fri6963
96 22.75 3.25 Female No Fri Dinner 2 11.38 Jamie Garza 676318332068 Fri2318
97 40.17 4.73 Male Yes Fri Dinner 4 10.04 Aaron Bentley 180026611638690 Fri9628
98 27.28 4.0 Male Yes Fri Dinner 2 13.64 Eric Carter 4563054452787961 Fri3159
99 12.03 1.5 Male Yes Fri Dinner 2 6.02 Eric Herrera 580116092652 Fri9268
100 21.01 3.0 Male Yes Fri Dinner 2 10.5 Michael Li 4831801127457917 Fri144
101 12.46 1.5 Male No Fri Dinner 2 6.23 Edward Carter 347435564751626 Fri5575
102 11.35 2.5 Female Yes Fri Dinner 2 5.68 Lori Lynch 38558279384492 Fri4106
103 15.38 3.0 Female Yes Fri Dinner 2 7.69 Tiffany Colon 6011012799432041 Fri8382
104 44.3 2.5 Female Yes Sat Dinner 3 14.77 Heather Cohen 379771118886604 Sat6240
105 22.42 3.48 Female Yes Sat Dinner 2 11.21 Kathleen Hawkins 348009865484721 Sat1015
106 20.92 4.08 Female No Sat Dinner 2 10.46 Gabrielle Frederick 4013010878990106 Sat3194
107 15.36 1.64 Male Yes Sat Dinner 2 7.68 David Price 4029957452720 Sat5106
108 20.49 4.06 Male Yes Sat Dinner 2 10.24 Karl Mcdaniel 180024452771522 Sat7865
109 25.21 4.29 Male Yes Sat Dinner 2 12.6 Jason Mullen 4738781782868 Sat5196
110 18.24 3.76 Male No Sat Dinner 2 9.12 Steven Grant 4112810433473856 Sat6376
111 14.31 4.0 Female Yes Sat Dinner 2 7.16 Amanda Anderson 375638820334211 Sat2614
112 14.0 3.0 Male No Sat Dinner 2 7.0 James Sanchez 345243048851323 Sat6801
113 7.25 1.0 Female No Sat Dinner 1 7.25 Terri Jones 3559221007826887 Sat4801
114 38.07 4.0 Male No Sun Dinner 3 12.69 Jeff Lopez 3572865915176463 Sun591
115 23.95 2.55 Male No Sun Dinner 2 11.98 John Joyce 6565964211060570 Sun1885
116 25.71 4.0 Female No Sun Dinner 3 8.57 Katie Smith 5400160161311292 Sun6492
117 17.31 3.5 Female No Sun Dinner 2 8.65 Kayla Stone 379494319310858 Sun8746
118 29.93 5.07 Male No Sun Dinner 4 7.48 Shawn Blake 4689079711213722 Sun22
119 10.65 1.5 Female No Thur Lunch 2 5.32 Linda Zhang 3560509622598239 Thur9593
120 12.43 1.8 Female No Thur Lunch 2 6.22 Dr. Caroline Tucker 502047186908 Thur8084
121 24.08 2.92 Female No Thur Lunch 4 6.02 Melanie Jordan 676212062720 Thur8063
122 11.69 2.31 Male No Thur Lunch 2 5.84 Kenneth Goodman 4891259691010 Thur8289
123 13.42 1.68 Female No Thur Lunch 2 6.71 Laura Garcia 5181484390945653 Thur2158
124 14.26 2.5 Male No Thur Lunch 2 7.13 Perry Garcia 180034646320219 Thur3579
125 15.95 2.0 Male No Thur Lunch 2 7.98 Christopher Lang 4820629318698319 Thur1992
126 12.48 2.52 Female No Thur Lunch 2 6.24 Jordan Diaz 4472778228206399 Thur208
127 29.8 4.2 Female No Thur Lunch 6 4.97 Angela Sanchez 503857080488 Thur3948
128 8.52 1.48 Male No Thur Lunch 2 4.26 Mario Bradshaw 4524404353861811 Thur6719
129 14.52 2.0 Female No Thur Lunch 2 7.26 Jessica Simmons 213102478792200 Thur1512
130 11.38 2.0 Female No Thur Lunch 2 5.69 Christine Perkins 3548391118913991 Thur8551
131 22.82 2.18 Male No Thur Lunch 3 7.61 Raymond Torres 4855776744024 Thur9424
132 19.08 1.5 Male No Thur Lunch 2 9.54 Seth Sexton 213113680829581 Thur1446
133 20.27 2.83 Female No Thur Lunch 2 10.14 Ashley Burke 5394652998970066 Thur9005
134 11.17 1.5 Female No Thur Lunch 2 5.58 Taylor Gonzalez 6011990685390011 Thur7783
135 12.26 2.0 Female No Thur Lunch 2 6.13 Kaitlin Wolf 676348318145 Thur1561
136 18.26 3.25 Female No Thur Lunch 2 9.13 Karen Rodriguez 4952604748911 Thur75
137 8.51 1.25 Female No Thur Lunch 2 4.26 Rebecca Harris 4320272020376174 Thur6600
138 10.33 2.0 Female No Thur Lunch 2 5.16 Donna Kelly 180048553626376 Thur1393
139 14.15 2.0 Female No Thur Lunch 2 7.08 Vanessa Morris 213189344156819 Thur3890
140 16.0 2.0 Male Yes Thur Lunch 2 8.0 Jason Burgess 3561461821942363 Thur2710
141 13.16 2.75 Female No Thur Lunch 2 6.58 Lindsey Meyer 676239597203 Thur6245
142 17.47 3.5 Female No Thur Lunch 2 8.74 Kayla Rios 5233918213804470 Thur3906
143 34.3 6.7 Male No Thur Lunch 6 5.72 Steven Carlson 3526515703718508 Thur1025
144 41.19 5.0 Male No Thur Lunch 5 8.24 Eric Andrews 4356531761046453 Thur3621
145 27.05 5.0 Female No Thur Lunch 6 4.51 Regina Jones 4311048695487 Thur6179
146 16.43 2.3 Female No Thur Lunch 2 8.22 Linda Jones 6542729219645658 Thur9002
147 8.35 1.5 Female No Thur Lunch 2 4.18 Amy Young 4285454264477 Thur9331
148 18.64 1.36 Female No Thur Lunch 3 6.21 Kelly Estrada 060463302327 Thur3941
149 11.87 1.63 Female No Thur Lunch 2 5.94 Annette Cunningham 675937746864 Thur4780
150 9.78 1.73 Male No Thur Lunch 2 4.89 David Stewart 3578014604116399 Thur7276
151 7.51 2.0 Male No Thur Lunch 2 3.76 Daniel Robbins 4823139288341889 Thur6321
152 14.07 2.5 Male No Sun Dinner 2 7.04 Luke Rice 4813617017359506 Sun8863
153 13.13 2.0 Male No Sun Dinner 2 6.56 Jason Arnold 3571825125296106 Sun2127
154 17.26 2.74 Male No Sun Dinner 3 5.75 Gregory Smith 4292362333741 Sun5205
155 24.55 2.0 Male No Sun Dinner 4 6.14 Todd Patterson 4416804908942159 Sun8670
156 19.77 2.0 Male No Sun Dinner 4 4.94 James Smith 213169731428229 Sun5814
157 29.85 5.14 Female No Sun Dinner 5 5.97 Madison Wilson 4210875236164664 Sun9176
158 48.17 5.0 Male No Sun Dinner 6 8.03 Ryan Gonzales 3523151482063321 Sun7518
159 25.0 3.75 Female No Sun Dinner 4 6.25 Laura Robles 213158685144262 Sun7015
160 13.39 2.61 Female No Sun Dinner 2 6.7 Ashley Boyd 3571088058115021 Sun982
161 16.49 2.0 Male No Sun Dinner 4 4.12 Christopher Soto 30501814271434 Sun1781
162 21.5 3.5 Male No Sun Dinner 4 5.38 Travis Gonzalez 3527668419764685 Sun245
163 12.66 2.5 Male No Sun Dinner 2 6.33 Brandon Oconnor 4406882156920533 Sun5879
164 16.21 2.0 Female No Sun Dinner 3 5.4 Jennifer Baird 4227834176859693 Sun5521
165 13.81 2.0 Male No Sun Dinner 2 6.9 Charles Newton 5552793481414044 Sun8594
166 17.51 3.0 Female Yes Sun Dinner 2 8.76 Audrey Griffin 3500853929693258 Sun444
167 24.52 3.48 Male No Sun Dinner 3 8.17 Jacob Hansen 4031116007387 Sun9043
168 20.76 2.24 Male No Sun Dinner 2 10.38 Gordon Lane 4110599849536479 Sun6738
169 31.71 4.5 Male No Sun Dinner 4 7.93 Michael Lawson 3566285921227119 Sun3719
170 10.59 1.61 Female Yes Sat Dinner 2 5.3 Sara Jimenez 502053147208 Sat9795
171 10.63 2.0 Female Yes Sat Dinner 2 5.32 Amy Hill 3536332481454019 Sat1788
172 50.81 10.0 Male Yes Sat Dinner 3 16.94 Gregory Clark 5473850968388236 Sat1954
173 15.81 3.16 Male Yes Sat Dinner 2 7.9 David Hall 502004138207 Sat6750
174 7.25 5.15 Male Yes Sun Dinner 2 3.62 Larry White 30432617123103 Sun9209
175 31.85 3.18 Male Yes Sun Dinner 2 15.92 Scott Perez 3577115550328507 Sun9335
176 16.82 4.0 Male Yes Sun Dinner 2 8.41 Brian Miles 3586342145399277 Sun7621
177 32.9 3.11 Male Yes Sun Dinner 2 16.45 Nathan Reynolds 370307040837149 Sun5109
178 17.89 2.0 Male Yes Sun Dinner 2 8.94 Walter Simmons 6011481578696110 Sun5961
179 14.48 2.0 Male Yes Sun Dinner 2 7.24 John Dudley 4565183162071073 Sun6203
180 9.6 4.0 Female Yes Sun Dinner 2 4.8 Melanie Gray 4211808859168 Sun4598
181 34.63 3.55 Male Yes Sun Dinner 2 17.32 Brian Bailey 346656312114848 Sun9851
182 34.65 3.68 Male Yes Sun Dinner 4 8.66 James Hebert DDS 676168737648 Sun7544
183 23.33 5.65 Male Yes Sun Dinner 2 11.66 Jason Cox 6556931703586223 Sun3402
184 45.35 3.5 Male Yes Sun Dinner 3 15.12 Jose Parsons 4112207559459910 Sun2337
185 23.17 6.5 Male Yes Sun Dinner 4 5.79 Dr. Michael James 4718501859162 Sun6059
186 40.55 3.0 Male Yes Sun Dinner 2 20.27 Stephen Cox 3547798222044029 Sun5140
187 20.69 5.0 Male No Sun Dinner 5 4.14 Joseph Howell 30362407455623 Sun5842
188 20.9 3.5 Female Yes Sun Dinner 3 6.97 Heidi Atkinson 4422858423131187 Sun4254
189 30.46 2.0 Male Yes Sun Dinner 5 6.09 David Barrett 4792882899700988 Sun9987
190 18.15 3.5 Female Yes Sun Dinner 3 6.05 Glenda Wiggins 578329325307 Sun430
191 23.1 4.0 Male Yes Sun Dinner 3 7.7 Richard Stevens 3560193117506187 Sun1821
192 15.69 1.5 Male Yes Sun Dinner 2 7.84 Riley Barnes 180053549128800 Sun5104
193 19.81 4.19 Female Yes Thur Lunch 2 9.9 Kristy Boyd 4317015327600068 Thur967
194 28.44 2.56 Male Yes Thur Lunch 2 14.22 Dr. Jeffrey Rich 4737538358295 Thur4334
195 15.48 2.02 Male Yes Thur Lunch 2 7.74 Raymond Sullivan 180068856139315 Thur606
196 16.58 4.0 Male Yes Thur Lunch 2 8.29 Benjamin Weber 676210011505 Thur9318
197 7.56 1.44 Male No Thur Lunch 2 3.78 Michael White 4865390263095532 Thur697
198 10.34 2.0 Male Yes Thur Lunch 2 5.17 Eric Martin 30442491190342 Thur9862
199 43.11 5.0 Female Yes Thur Lunch 4 10.78 Brooke Soto 5544902205760175 Thur9313
200 13.0 2.0 Female Yes Thur Lunch 2 6.5 Katherine Bond 4926725945192 Thur437
201 13.51 2.0 Male Yes Thur Lunch 2 6.76 Joseph Murphy MD 6547218923471275 Thur2428
202 18.71 4.0 Male Yes Thur Lunch 3 6.24 Jason Conrad 4581233003487 Thur6048
203 12.74 2.01 Female Yes Thur Lunch 2 6.37 Abigail Parks 3586645396220590 Thur2544
204 13.0 2.0 Female Yes Thur Lunch 2 6.5 Ashley Shaw 180088043008041 Thur1301
205 16.4 2.5 Female Yes Thur Lunch 2 8.2 Toni Brooks 3582289985920239 Thur7770
206 20.53 4.0 Male Yes Thur Lunch 4 5.13 Scott Kim 3570611756827620 Thur2160
207 16.47 3.23 Female Yes Thur Lunch 3 5.49 Carly Reyes 4787787236486 Thur8084
208 26.59 3.41 Male Yes Sat Dinner 3 8.86 Daniel Owens 38971087967574 Sat1
209 38.73 3.0 Male Yes Sat Dinner 4 9.68 Ricky Ramirez 347817964484033 Sat4505
210 24.27 2.03 Male Yes Sat Dinner 2 12.14 Jason Carter 4268942915626180 Sat6048
211 12.76 2.23 Female Yes Sat Dinner 2 6.38 Sarah Cunningham 341876516331163 Sat1274
212 30.06 2.0 Male Yes Sat Dinner 3 10.02 Shawn Mendoza 30184049218122 Sat8361
213 25.89 5.16 Male Yes Sat Dinner 4 6.47 Christopher Li 6011962464150569 Sat6735
214 48.33 9.0 Male No Sat Dinner 4 12.08 Alex Williamson 676218815212 Sat4590
215 13.27 2.5 Female Yes Sat Dinner 2 6.64 Robin Andersen 580140531089 Sat1374
216 28.17 6.5 Female Yes Sat Dinner 3 9.39 Marissa Jackson 4922302538691962 Sat3374
217 12.9 1.1 Female Yes Sat Dinner 2 6.45 Jessica Owen 4726904879471 Sat6983
218 28.15 3.0 Male Yes Sat Dinner 5 5.63 Shawn Barnett PhD 4590982568244 Sat7320
219 11.59 1.5 Male Yes Sat Dinner 2 5.8 Gary Orr 30324521283406 Sat8489
220 7.74 1.44 Male Yes Sat Dinner 2 3.87 Nicholas Archer 340517153733524 Sat4772
221 30.14 3.09 Female Yes Sat Dinner 4 7.54 Shelby House 502097403252 Sat8863
222 12.16 2.2 Male Yes Fri Lunch 2 6.08 Ricky Johnson 213109508670736 Fri4607
223 13.42 3.48 Female Yes Fri Lunch 2 6.71 Leslie Kaufman 379437981958785 Fri7511
224 8.58 1.92 Male Yes Fri Lunch 1 8.58 Jason Lawrence 3505302934650403 Fri6624
225 15.98 3.0 Female No Fri Lunch 3 5.33 Mary Rivera 5343428579353069 Fri6014
226 13.42 1.58 Male Yes Fri Lunch 2 6.71 Ronald Vaughn DVM 341503466406403 Fri5959
227 16.27 2.5 Female Yes Fri Lunch 2 8.14 Whitney Arnold 3579111947217428 Fri6665
228 10.09 2.0 Female Yes Fri Lunch 2 5.04 Ruth Weiss 5268689490381635 Fri6359
229 20.45 3.0 Male No Sat Dinner 4 5.11 Robert Bradley 213141668145910 Sat4319
230 13.28 2.72 Male No Sat Dinner 2 6.64 Glenn Jones 502061651712 Sat2937
231 22.12 2.88 Female Yes Sat Dinner 2 11.06 Jennifer Russell 4793003293608 Sat3943
232 24.01 2.0 Male Yes Sat Dinner 4 6.0 Michael Osborne 4258682154026 Sat7872
233 15.69 3.0 Male Yes Sat Dinner 3 5.23 Jason Parks 4812333796161 Sat6334
234 11.61 3.39 Male No Sat Dinner 2 5.8 James Taylor 6011482917327995 Sat2124
235 10.77 1.47 Male No Sat Dinner 2 5.38 Paul Novak 6011698897610858 Sat1467
236 15.53 3.0 Male Yes Sat Dinner 2 7.76 Tracy Douglas 4097938155941930 Sat7220
237 10.07 1.25 Male No Sat Dinner 2 5.04 Sean Gonzalez 3534021246117605 Sat4615
238 12.6 1.0 Male Yes Sat Dinner 2 6.3 Matthew Myers 3543676378973965 Sat5032
239 32.83 1.17 Male Yes Sat Dinner 2 16.42 Thomas Brown 4284722681265508 Sat2929
240 35.83 4.67 Female No Sat Dinner 3 11.94 Kimberly Crane 676184013727 Sat9777
241 29.03 5.92 Male No Sat Dinner 3 9.68 Michael Avila 5296068606052842 Sat2657
242 27.18 2.0 Female Yes Sat Dinner 2 13.59 Monica Sanders 3506806155565404 Sat1766
243 22.67 2.0 Male Yes Sat Dinner 2 11.34 Keith Wong 6011891618747196 Sat3880
244 17.82 1.75 Male No Sat Dinner 2 8.91 Dennis Dixon 4375220550950 Sat17
245 18.78 3.0 Female No Thur Dinner 2 9.39 Michelle Hardin 3511451626698139 Thur672

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save