diff --git a/.DS_Store b/.DS_Store
index ac331c8..0c481ba 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/Pandas/.DS_Store b/Pandas/.DS_Store
new file mode 100644
index 0000000..38a8d8a
Binary files /dev/null and b/Pandas/.DS_Store differ
diff --git a/Pandas/.ipynb_checkpoints/AggregateFunctions-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/AggregateFunctions-checkpoint.ipynb
new file mode 100755
index 0000000..29d4bd1
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/AggregateFunctions-checkpoint.ipynb
@@ -0,0 +1,208 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "interest_filter = df['interest_rate']==0.0702\n",
+ "df = df.loc[car_filter & interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Aggregate Methods\n",
+ "It is often a good idea to compute summary statistics."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Aggregate Method | Description\n",
+ "--- | --- \n",
+ "sum | sum of values\n",
+ "cumsum | cumulative sum\n",
+ "mean | mean of values\n",
+ "median | arithmetic median of values\n",
+ "min | minimum\n",
+ "max | maximum\n",
+ "mode | mode\n",
+ "std | unbiased standard deviation\n",
+ "var | unbiased variance\n",
+ "quantile | compute rank-based statistics of elements"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# sum the values in a column\n",
+ "# total amount of interest paid over the course of the loan\n",
+ "df['interest_paid'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# sum all the values across all columns\n",
+ "df.sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "'Toyota Sienna' + 'Toyota Sienna'"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice that by default it seems like the sum function ignores missing values. \n",
+ "help(df['interest_paid'].sum)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# The info method gives the column datatypes + number of non-null values\n",
+ "# Notice that we seem to have 60 non-null values for all but the Interest Paid column. \n",
+ "df.info()"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/BasicOperations-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/BasicOperations-checkpoint.ipynb
new file mode 100755
index 0000000..1b350a6
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/BasicOperations-checkpoint.ipynb
@@ -0,0 +1,125 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Basic Operations\n",
+ "\n",
+ "1. Assure that you have correctly loaded the data. \n",
+ "2. See what kind of data you have. \n",
+ "3. Check the validity of your data."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Viewing the first and last 5 rows"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select top N number of records (default = 5)\n",
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select bottom N number of records (default = 5)\n",
+ "df.tail()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Check the column data types"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Check the column data types using the dtypes attribute\n",
+ "# For example, you can wrongly assume the values in one of your columns is \n",
+ "# a int64 instead of a string. \n",
+ "df.dtypes"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Use the shape attribute to get the number of rows and columns in your dataframe\n",
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# The info method gives the column datatypes + number of non-null values\n",
+ "# Notice that we seem to have 408 non-null values for all but the Interest Paid column. \n",
+ "df.info()"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/ConvertNumPyArrayDict-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/ConvertNumPyArrayDict-checkpoint.ipynb
new file mode 100755
index 0000000..77c26f6
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/ConvertNumPyArrayDict-checkpoint.ipynb
@@ -0,0 +1,202 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "interest_filter = df['interest_rate']==0.0702\n",
+ "df = df.loc[car_filter & interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# missing values can be excluded in calculations by default. \n",
+ "# excludes missing values in the calculation \n",
+ "interest_missing = df['interest_paid'].isna()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Fill in with the actual value\n",
+ "df.loc[interest_missing,'interest_paid'] = 93.24"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Convert Pandas DataFrames to NumPy arrays or Dictionaries"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Convert Pandas DataFrames to NumPy Arrays"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "df.to_numpy()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2\n",
+ "df.values"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Convert Pandas DataFrames to Dictionaries"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.to_dict()"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/CreateData-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/CreateData-checkpoint.ipynb
new file mode 100755
index 0000000..d7e6463
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/CreateData-checkpoint.ipynb
@@ -0,0 +1,232 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Create Data\n",
+ "To be able to visualize data, we first need to be able to get and manipulate data. In this section, we are going to create our own data.\n",
+ "\n",
+ "The data is the start of a payment table for a car loan of 34690 dollars with a 7.02 interest rate over 60 months."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 List\n",
+ "carLoans = [[1, 34689.96, 687.23, 202.93, 484.3, 34205.66, 60, 0.0702,'Toyota Sienna'],\n",
+ " [2, 34205.66, 687.23, 200.1, 487.13, 33718.53, 60, 0.0702,'Toyota Sienna'],\n",
+ " [3, 33718.53, 687.23, 197.25, 489.98, 33228.55, 60, 0.0702,'Toyota Sienna'],\n",
+ " [4, 33228.55, 687.23, 194.38, 492.85, 32735.7, 60, 0.0702,'Toyota Sienna'],\n",
+ " [5, 32735.7, 687.23, 191.5, 495.73, 32239.97, 60, 0.0702,'Toyota Sienna']]\n",
+ "\n",
+ "colNames = ['Month',\n",
+ " 'Starting Balance',\n",
+ " 'Repayment',\n",
+ " 'Interest Paid',\n",
+ " 'Principal Paid',\n",
+ " 'New Balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df = pd.DataFrame(data = carLoans, columns=colNames)\n",
+ "df"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 NumPy Array\n",
+ "carLoans = np.array([\n",
+ " [1, 34689.96, 687.23, 202.93, 484.3, 34205.66, 60, 0.0702,'Toyota Sienna'],\n",
+ " [2, 34205.66, 687.23, 200.1, 487.13, 33718.53, 60, 0.0702,'Toyota Sienna'],\n",
+ " [3, 33718.53, 687.23, 197.25, 489.98, 33228.55, 60, 0.0702,'Toyota Sienna'],\n",
+ " [4, 33228.55, 687.23, 194.38, 492.85, 32735.7, 60, 0.0702,'Toyota Sienna'],\n",
+ " [5, 32735.7, 687.23, 191.5, 495.73, 32239.97, 60, 0.0702,'Toyota Sienna']\n",
+ " ])\n",
+ " \n",
+ "colNames = ['Month',\n",
+ " 'Starting Balance',\n",
+ " 'Repayment',\n",
+ " 'Interest Paid',\n",
+ " 'Principal Paid',\n",
+ " 'New Balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']\n",
+ "\n",
+ "df = pd.DataFrame(data = carLoans, columns=colNames)\n",
+ "df "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 3 Python Dictionary\n",
+ "carLoans = {'Month': {0: 1, 1: 2, 2: 3, 3: 4, 4: 5},\n",
+ " 'Starting Balance': {0: 34689.96,1: 34205.66,2: 33718.53,3: 33228.55,4: 32735.7},\n",
+ " 'Repayment': {0: 687.23, 1: 687.23, 2: 687.23, 3: 687.23, 4: 687.23},\n",
+ " 'Interest Paid': {0: 202.93, 1: 200.1, 2: 197.25, 3: 194.38, 4: 191.5},\n",
+ " 'Principal Paid': {0: 484.3, 1: 487.13, 2: 489.98, 3: 492.85, 4: 495.73},\n",
+ " 'New Balance': {0: 34205.66,1: 33718.53,2: 33228.55,3: 32735.7,4: 32239.97},\n",
+ " 'term': {0: 60, 1: 60, 2: 60, 3: 60, 4: 60},\n",
+ " 'interest_rate': {0: 0.0702, 1: 0.0702, 2: 0.0702, 3: 0.0702, 4: 0.0702},\n",
+ " 'car_type': {0: 'Toyota Sienna',1: 'Toyota Sienna',2: 'Toyota Sienna',3: 'Toyota Sienna',4: 'Toyota Sienna'}}\n",
+ "\n",
+ "df = pd.DataFrame(data = carLoans)\n",
+ "df"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Limitation of this Approach\n",
+ "If you have a larger dataset (like the entire payment table), it doesnt make sense to manually put data into a dataframe. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# this is painfully slow to type\n",
+ "carLoans = [\n",
+ " [1, 34689.96, 687.23, 202.93, 484.3, 34205.66, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [2, 34205.66, 687.23, 200.1, 487.13, 33718.53, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [3, 33718.53, 687.23, 197.25, 489.98, 33228.55, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [4, 33228.55, 687.23, 194.38, 492.85, 32735.7, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [5, 32735.7, 687.23, 191.5, 495.73, 32239.97, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [6, 32239.97, 687.23, 188.6, 498.63, 31741.34, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [7, 31741.34, 687.23, 185.68, 501.55, 31239.79, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [8, 31239.79, 687.23, 182.75, 504.48, 30735.31, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [9, 30735.31, 687.23, 179.8, 507.43, 30227.88, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [10, 30227.88, 687.23, 176.83, 510.4, 29717.48, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [11, 29717.48, 687.23, 173.84, 513.39, 29204.09, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [12, 29204.09, 687.23, 170.84, 516.39, 28687.7, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [13, 28687.7, 687.23, 167.82, 519.41, 28168.29, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [14, 28168.29, 687.23, 164.78, 522.45, 27645.84, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [15, 27645.84, 687.23, 161.72, 525.51, 27120.33, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [16, 27120.33, 687.23, 158.65, 528.58, 26591.75, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [17, 26591.75, 687.23, 155.56, 531.67, 26060.08, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [18, 26060.08, 687.23, 152.45, 534.78, 25525.3, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [19, 25525.3, 687.23, 149.32, 537.91, 24987.39, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [20, 24987.39, 687.23, 146.17, 541.06, 24446.33, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [21, 24446.33, 687.23, 143.01, 544.22, 23902.11, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [22, 23902.11, 687.23, 139.82, 547.41, 23354.7, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [23, 23354.7, 687.23, 136.62, 550.61, 22804.09, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [24, 22804.09, 687.23, 133.4, 553.83, 22250.26, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [25, 22250.26, 687.23, 130.16, 557.07, 21693.19, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [26, 21693.19, 687.23, 126.9, 560.33, 21132.86, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [27, 21132.86, 687.23, 123.62, 563.61, 20569.25, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [28, 20569.25, 687.23, 120.33, 566.9, 20002.35, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [29, 20002.35, 687.23, 117.01, 570.22, 19432.13, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [30, 19432.13, 687.23, 113.67, 573.56, 18858.57, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [31, 18858.57, 687.23, 110.32, 576.91, 18281.66, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [32, 18281.66, 687.23, 106.94, 580.29, 17701.37, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [33, 17701.37, 687.23, 103.55, 583.68, 17117.69, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [34, 17117.69, 687.23, 100.13, 587.1, 16530.59, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [35, 16530.59, 687.23, 96.7, 590.53, 15940.06, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [36, 15940.06, 687.23, 93.24, 593.99, 15346.07, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [37, 15346.07, 687.23, 89.77, 597.46, 14748.61, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [38, 14748.61, 687.23, 86.27, 600.96, 14147.65, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [39, 14147.65, 687.23, 82.76, 604.47, 13543.18, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [40, 13543.18, 687.23, 79.22, 608.01, 12935.17, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [41, 12935.17, 687.23, 75.67, 611.56, 12323.61, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [42, 12323.61, 687.23, 72.09, 615.14, 11708.47, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [43, 11708.47, 687.23, 68.49, 618.74, 11089.73, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [44, 11089.73, 687.23, 64.87, 622.36, 10467.37, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [45, 10467.37, 687.23, 61.23, 626.0, 9841.37, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [46, 9841.37, 687.23, 57.57, 629.66, 9211.71, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [47, 9211.71, 687.23, 53.88, 633.35, 8578.36, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [48, 8578.36, 687.23, 50.18, 637.05, 7941.31, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [49, 7941.31, 687.23, 46.45, 640.78, 7300.53, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [50, 7300.53, 687.23, 42.7, 644.53, 6656.0, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [51, 6656.0, 687.23, 38.93, 648.3, 6007.7, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [52, 6007.7, 687.23, 35.14, 652.09, 5355.61, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [53, 5355.61, 687.23, 31.33, 655.9, 4699.71, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [54, 4699.71, 687.23, 27.49, 659.74, 4039.97, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [55, 4039.97, 687.23, 23.63, 663.6, 3376.37, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [56, 3376.37, 687.23, 19.75, 667.48, 2708.89, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [57, 2708.89, 687.23, 15.84, 671.39, 2037.5, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [58, 2037.5, 687.23, 11.91, 675.32, 1362.18, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [59, 1362.18, 687.23, 7.96, 679.27, 682.91, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [60, 682.91, 687.23, 3.99, 683.24, -0.33, 60, 0.0702, 'Toyota Sienna']\n",
+ " ]\n",
+ "\n",
+ "colNames = ['Month',\n",
+ " 'Starting Balance',\n",
+ " 'Repayment',\n",
+ " 'Interest Paid',\n",
+ " 'Principal Paid',\n",
+ " 'New Balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']\n",
+ "\n",
+ "df = pd.DataFrame(data = carLoans, columns=colNames)\n",
+ "df"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "help(pd.DataFrame)"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/ExportCSVExcel-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/ExportCSVExcel-checkpoint.ipynb
new file mode 100755
index 0000000..f234ec7
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/ExportCSVExcel-checkpoint.ipynb
@@ -0,0 +1,212 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "if issues install conda install -c conda-forge openpyxl"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "interest_filter = df['interest_rate']==0.0702\n",
+ "df = df.loc[car_filter & interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# missing values can be excluded in calculations by default. \n",
+ "# excludes missing values in the calculation \n",
+ "interest_missing = df['interest_paid'].isna()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Fill in with the actual value\n",
+ "df.loc[interest_missing,'interest_paid'] = 93.24"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Export Pandas DataFrames to csv and excel files "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Export DataFrame to csv File\n",
+ "df.to_csv(path_or_buf='data/table_i702t60.csv',\n",
+ " index = True)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "If you get an error below, you probably need to install openpyxl or similar. \n",
+ "\n",
+ "stackoverflow: https://stackoverflow.com/questions/34509198/no-module-named-openpyxl-python-3-4-ubuntu\n",
+ "\n",
+ "`conda install openpyxl` or \n",
+ "\n",
+ "`conda install -c anaconda openpyxl`\n",
+ "`pip install openpyxl`"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# If you get the error below, try installing a library\n",
+ "# Export DataFrame to excel File\n",
+ "df.to_excel(excel_writer='data/table_i702t60.xlsx',\n",
+ " index=False)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Keep in mind that if you dont know a methods parameters,\n",
+ "# you can look them up using the help command. \n",
+ "help(df.to_csv)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "It is also good idea to check your exported files."
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/Filtering-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/Filtering-checkpoint.ipynb
new file mode 100755
index 0000000..74d46f9
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/Filtering-checkpoint.ipynb
@@ -0,0 +1,246 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Filtering Data\n",
+ "Filter out the data to only have data `car_type` of 'Toyota Sienna' and `interest_rate` of 0.0702."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### car_type filter\n",
+ "Comparison Operator | Meaning\n",
+ "--- | --- \n",
+ "< | less than\n",
+ "<= | less than or equal to\n",
+ "> | greater than\n",
+ ">= | greater than or equal to\n",
+ "== | equal\n",
+ "!= | not equal"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Let's first start by looking at the car_type column. \n",
+ "df['car_type'].value_counts()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice that the filter produces a pandas series of True and False values\n",
+ "car_filter = df['car_type']=='Toyota Sienna'"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "car_filter.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 using square brackets\n",
+ "# Filter dataframe to get a DataFrame of only 'Toyota Sienna'\n",
+ "df[car_filter].head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 using loc\n",
+ "# Filter dataframe to get a DataFrame of only 'Toyota Sienna'\n",
+ "df.loc[car_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice that it looks like nothing changed\n",
+ "# This is because we didn't update the dataframe after applying the filter\n",
+ "df['car_type'].value_counts()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Filter dataframe to get a DataFrame of only 'Toyota Sienna'\n",
+ "df = df.loc[car_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['car_type'].value_counts()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### interest_rate Filter\n",
+ "Comparison Operator | Meaning\n",
+ "--- | --- \n",
+ "< | less than\n",
+ "<= | less than or equal to\n",
+ "> | greater than\n",
+ ">= | greater than or equal to\n",
+ "== | equal\n",
+ "!= | not equal"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['interest_rate'].value_counts()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice that the filter produces a pandas series of True and False values\n",
+ "df['interest_rate']==0.0702"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "interest_filter = df['interest_rate']==0.0702"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df = df.loc[interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['interest_rate'].value_counts(dropna = False)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Combining Filters\n",
+ "In the previous sections, we created `car_filter` and `interest_filter` and used the `loc` command to filter the data by first applying the `car_filter` and then the `interest_filter`. An more concise way to do it is shown below. \n",
+ "\n",
+ "Bitwise Logic Operator | Meaning\n",
+ "--- | --- \n",
+ "& | and\n",
+ "\\| | or\n",
+ "^ | exclusive or\n",
+ "~ | not"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.loc[car_filter & interest_filter, :]"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/IdentifyingMissingData-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/IdentifyingMissingData-checkpoint.ipynb
new file mode 100755
index 0000000..76d9193
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/IdentifyingMissingData-checkpoint.ipynb
@@ -0,0 +1,222 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "interest_filter = df['interest_rate']==0.0702\n",
+ "df = df.loc[car_filter & interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Identifying Missing Data\n",
+ "Values will be originally missing from a dataset or be a product of data manipulation. In pandas, missing values are typically called `NaN` or `None`.\n",
+ "\n",
+ "Missing data can: \n",
+ "* Hint at data collection errors.\n",
+ "* Indicate improper conversion or manipulation.\n",
+ "* Actually not be considered missing. For some datasets, missing data can be listed as \"zero\", \"false\", \"not applicable\", \"entered an empty string\", among other possibilities. \n",
+ "\n",
+ "This is an important subject as before you can graph data, you should make sure you aren't trying to graph some missing values as that can cause an error or misinterpretation of the data. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Finding Missing Values"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.info()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Two common methods to indicate where values in a DataFrame are missing are `isna` and `isnull`. They are exactly the same methods, but with different names."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice we have a Pandas Series of True and False values\n",
+ "df['interest_paid'].isna().head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "interest_missing = df['interest_paid'].isna()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Looks at the row that contains the NaN for interest_paid\n",
+ "df.loc[interest_missing,:]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "# Keep in mind that we can use the not operator (~) to negate the filter\n",
+ "# every row that doesn't have a nan is returned.\n",
+ "df.loc[~interest_missing,:]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# The code counts the number of missing values\n",
+ "# sum() works because Booleans are a subtype of integers. \n",
+ "df['interest_paid'].isna().sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "True + False + False "
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/IntroPandas-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/IntroPandas-checkpoint.ipynb
new file mode 100755
index 0000000..85b8935
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/IntroPandas-checkpoint.ipynb
@@ -0,0 +1,39 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Introduction to Pandas\n",
+ "This lesson, outlines techniques for effectively loading, storing, manipulating, and exporting in-memory data in Python. In order to make apply a machine learning algorithm or even make a visualization, we need data and it helps to have it in an organized tablular form.\n",
+ "The pandas library provides easy-to-use data structures and data analysis tools that you can use to clean and understand your data.\n",
+ "\n",
+ "An important data structure of the pandas library is a fast and efficient object for data manipulation called a `DataFrame`. \n",
+ "\n",
+ ""
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/LoadData-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/LoadData-checkpoint.ipynb
new file mode 100755
index 0000000..1693213
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/LoadData-checkpoint.ipynb
@@ -0,0 +1,114 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Load Data "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Load CSV File\n",
+ "In this part of the video we are loading a file and just assuming it is loading properly. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load car loan data from a csv file\n",
+ "filename = 'data/car_financing.csv'\n",
+ "df = pd.read_csv(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Load Excel File"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "help(pd.read_excel)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/RemoveFillMissingData-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/RemoveFillMissingData-checkpoint.ipynb
new file mode 100755
index 0000000..d6723ec
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/RemoveFillMissingData-checkpoint.ipynb
@@ -0,0 +1,389 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "#interest_filter = df['interest_rate']==0.0702\n",
+ "car_filter"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.loc[car_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "interest_filter = df['interest_rate']==0.0702\n",
+ "df = df.loc[car_filter & interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Removing or Filling in Missing Data\n",
+ "This is an important subject as before you can graph data, you should make sure you aren't trying to graph some missing values as that can cause an error or misinterpretation of the data. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.info()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['interest_paid'].value_counts(dropna = False)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "help(df['interest_paid'].value_counts)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Remove Missing Values\n",
+ "You can remove missing values by using the `dropna` method. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.isnull().sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df[30:40]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "# You can drop entire rows if they contain 'any' nans in them or 'all'\n",
+ "# this may not be the best strategy for our dataset\n",
+ "df[30:40].dropna(how = 'any')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Filling in Missing Values\n",
+ "There are a [variety of ways to fill in missing values](https://pandas.pydata.org/pandas-docs/stable/user_guide/missing_data.html). "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Looking at where missing data is located\n",
+ "df['interest_paid'][30:40]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Filling in the nan with a zero is probably a bad idea. \n",
+ "df['interest_paid'][30:40].fillna(0)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# back fill in value\n",
+ "df['interest_paid'][30:40].fillna(method='bfill')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# forward fill in value\n",
+ "df['interest_paid'][30:40].fillna(method='ffill')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# linear interpolation (filling in of values)\n",
+ "df['interest_paid'][30:40].interpolate(method = 'linear')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Interest paid before filling in the nan with a value\n",
+ "df['interest_paid'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Fill in with the actual value\n",
+ "interest_missing = df['interest_paid'].isna()\n",
+ "df.loc[interest_missing,'interest_paid'] = 93.24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Interest paid after filling in the nan with a value\n",
+ "df['interest_paid'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice we dont have NaN values in the DataFrame anymore\n",
+ "df.info()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# not null\n",
+ "notNullFilter = ~df['interest_paid'].isnull()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.loc[notNullFilter, :]"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/RenamingDeletingColumns-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/RenamingDeletingColumns-checkpoint.ipynb
new file mode 100755
index 0000000..9ad400f
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/RenamingDeletingColumns-checkpoint.ipynb
@@ -0,0 +1,196 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Load Excel File"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Renaming and Deleting Columns\n",
+ "It is often the case where you change your column names or remove unnecessary columns."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Rename columns"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Here are two popular ways to rename dataframe columns.\n",
+ "1. dictionary substitution: very useful if you only want to rename a few of the columns.\n",
+ "2. list replacement: requires a full list of names (in my experience, this is more error prone)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# DataFrame before renaming columns\n",
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# This wont work as there is a space in the column name\n",
+ "# I want to fix that\n",
+ "df['Principal Paid']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# DataFrame after renaming columns\n",
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Deleting Columns"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/.ipynb_checkpoints/Slicing-checkpoint.ipynb b/Pandas/.ipynb_checkpoints/Slicing-checkpoint.ipynb
new file mode 100755
index 0000000..68ad1e9
--- /dev/null
+++ b/Pandas/.ipynb_checkpoints/Slicing-checkpoint.ipynb
@@ -0,0 +1,256 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Load Excel File"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Slicing\n",
+ "1. How to select columns in pandas \n",
+ "2. How to use slicing operations in pandas"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Select columns using brackets\n",
+ "With square brackets, you can select one or more columns."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select one column using double brackets\n",
+ "df[['car_type']].head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select multiple columns using double brackets\n",
+ "df[['car_type', 'Principal Paid']].head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# This is a Pandas DataFrame\n",
+ "type(df[['car_type']].head())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select one column using single brackets\n",
+ "# This produces a pandas series which is a one-dimensional array which can be labeled\n",
+ "df['car_type'].head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# This is a pandas series\n",
+ "type(df['car_type'].head())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Keep in mind that you can't select multiple colums using single brackets\n",
+ "# This will result in a KeyError\n",
+ "df['car_type', 'Principal Paid']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df[['car_type', 'Principal Paid']]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Pandas Slicing"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "With a pandas series, we can select rows using slicing like this: series[start_index:end_index]\n",
+ "\n",
+ "The end_index is not inclusive. This behavior is very similar to Python lists."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['car_type'][0:10]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select column using dot notation. \n",
+ "# This is not recommended.\n",
+ "df.car_type.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "\"\"\"\n",
+ "This won't work as there is a space in the column name. \n",
+ "Dot notation also fails if your column has the same name \n",
+ "of a DataFrame's attributes or methods.\n",
+ "\"\"\"\n",
+ "df.Principal Paid"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['Principal Paid']"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Selecting Columns using loc\n",
+ "The pandas attribute .loc allow you to select columns, index, and slice your data. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# pandas dataframe\n",
+ "df.loc[:, ['car_type']].head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# pandas series\n",
+ "df.loc[:, 'car_type'].head()"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/AggregateFunctions.ipynb b/Pandas/AggregateFunctions.ipynb
new file mode 100755
index 0000000..29d4bd1
--- /dev/null
+++ b/Pandas/AggregateFunctions.ipynb
@@ -0,0 +1,208 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "interest_filter = df['interest_rate']==0.0702\n",
+ "df = df.loc[car_filter & interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Aggregate Methods\n",
+ "It is often a good idea to compute summary statistics."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Aggregate Method | Description\n",
+ "--- | --- \n",
+ "sum | sum of values\n",
+ "cumsum | cumulative sum\n",
+ "mean | mean of values\n",
+ "median | arithmetic median of values\n",
+ "min | minimum\n",
+ "max | maximum\n",
+ "mode | mode\n",
+ "std | unbiased standard deviation\n",
+ "var | unbiased variance\n",
+ "quantile | compute rank-based statistics of elements"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# sum the values in a column\n",
+ "# total amount of interest paid over the course of the loan\n",
+ "df['interest_paid'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# sum all the values across all columns\n",
+ "df.sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "'Toyota Sienna' + 'Toyota Sienna'"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice that by default it seems like the sum function ignores missing values. \n",
+ "help(df['interest_paid'].sum)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# The info method gives the column datatypes + number of non-null values\n",
+ "# Notice that we seem to have 60 non-null values for all but the Interest Paid column. \n",
+ "df.info()"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/BasicOperations.ipynb b/Pandas/BasicOperations.ipynb
new file mode 100755
index 0000000..1b350a6
--- /dev/null
+++ b/Pandas/BasicOperations.ipynb
@@ -0,0 +1,125 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Basic Operations\n",
+ "\n",
+ "1. Assure that you have correctly loaded the data. \n",
+ "2. See what kind of data you have. \n",
+ "3. Check the validity of your data."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Viewing the first and last 5 rows"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select top N number of records (default = 5)\n",
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select bottom N number of records (default = 5)\n",
+ "df.tail()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Check the column data types"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Check the column data types using the dtypes attribute\n",
+ "# For example, you can wrongly assume the values in one of your columns is \n",
+ "# a int64 instead of a string. \n",
+ "df.dtypes"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Use the shape attribute to get the number of rows and columns in your dataframe\n",
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# The info method gives the column datatypes + number of non-null values\n",
+ "# Notice that we seem to have 408 non-null values for all but the Interest Paid column. \n",
+ "df.info()"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/ConvertNumPyArrayDict.ipynb b/Pandas/ConvertNumPyArrayDict.ipynb
new file mode 100755
index 0000000..77c26f6
--- /dev/null
+++ b/Pandas/ConvertNumPyArrayDict.ipynb
@@ -0,0 +1,202 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "interest_filter = df['interest_rate']==0.0702\n",
+ "df = df.loc[car_filter & interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# missing values can be excluded in calculations by default. \n",
+ "# excludes missing values in the calculation \n",
+ "interest_missing = df['interest_paid'].isna()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Fill in with the actual value\n",
+ "df.loc[interest_missing,'interest_paid'] = 93.24"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Convert Pandas DataFrames to NumPy arrays or Dictionaries"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Convert Pandas DataFrames to NumPy Arrays"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "df.to_numpy()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2\n",
+ "df.values"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Convert Pandas DataFrames to Dictionaries"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.to_dict()"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/CreateData.ipynb b/Pandas/CreateData.ipynb
new file mode 100755
index 0000000..d7e6463
--- /dev/null
+++ b/Pandas/CreateData.ipynb
@@ -0,0 +1,232 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Create Data\n",
+ "To be able to visualize data, we first need to be able to get and manipulate data. In this section, we are going to create our own data.\n",
+ "\n",
+ "The data is the start of a payment table for a car loan of 34690 dollars with a 7.02 interest rate over 60 months."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 List\n",
+ "carLoans = [[1, 34689.96, 687.23, 202.93, 484.3, 34205.66, 60, 0.0702,'Toyota Sienna'],\n",
+ " [2, 34205.66, 687.23, 200.1, 487.13, 33718.53, 60, 0.0702,'Toyota Sienna'],\n",
+ " [3, 33718.53, 687.23, 197.25, 489.98, 33228.55, 60, 0.0702,'Toyota Sienna'],\n",
+ " [4, 33228.55, 687.23, 194.38, 492.85, 32735.7, 60, 0.0702,'Toyota Sienna'],\n",
+ " [5, 32735.7, 687.23, 191.5, 495.73, 32239.97, 60, 0.0702,'Toyota Sienna']]\n",
+ "\n",
+ "colNames = ['Month',\n",
+ " 'Starting Balance',\n",
+ " 'Repayment',\n",
+ " 'Interest Paid',\n",
+ " 'Principal Paid',\n",
+ " 'New Balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df = pd.DataFrame(data = carLoans, columns=colNames)\n",
+ "df"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 NumPy Array\n",
+ "carLoans = np.array([\n",
+ " [1, 34689.96, 687.23, 202.93, 484.3, 34205.66, 60, 0.0702,'Toyota Sienna'],\n",
+ " [2, 34205.66, 687.23, 200.1, 487.13, 33718.53, 60, 0.0702,'Toyota Sienna'],\n",
+ " [3, 33718.53, 687.23, 197.25, 489.98, 33228.55, 60, 0.0702,'Toyota Sienna'],\n",
+ " [4, 33228.55, 687.23, 194.38, 492.85, 32735.7, 60, 0.0702,'Toyota Sienna'],\n",
+ " [5, 32735.7, 687.23, 191.5, 495.73, 32239.97, 60, 0.0702,'Toyota Sienna']\n",
+ " ])\n",
+ " \n",
+ "colNames = ['Month',\n",
+ " 'Starting Balance',\n",
+ " 'Repayment',\n",
+ " 'Interest Paid',\n",
+ " 'Principal Paid',\n",
+ " 'New Balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']\n",
+ "\n",
+ "df = pd.DataFrame(data = carLoans, columns=colNames)\n",
+ "df "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 3 Python Dictionary\n",
+ "carLoans = {'Month': {0: 1, 1: 2, 2: 3, 3: 4, 4: 5},\n",
+ " 'Starting Balance': {0: 34689.96,1: 34205.66,2: 33718.53,3: 33228.55,4: 32735.7},\n",
+ " 'Repayment': {0: 687.23, 1: 687.23, 2: 687.23, 3: 687.23, 4: 687.23},\n",
+ " 'Interest Paid': {0: 202.93, 1: 200.1, 2: 197.25, 3: 194.38, 4: 191.5},\n",
+ " 'Principal Paid': {0: 484.3, 1: 487.13, 2: 489.98, 3: 492.85, 4: 495.73},\n",
+ " 'New Balance': {0: 34205.66,1: 33718.53,2: 33228.55,3: 32735.7,4: 32239.97},\n",
+ " 'term': {0: 60, 1: 60, 2: 60, 3: 60, 4: 60},\n",
+ " 'interest_rate': {0: 0.0702, 1: 0.0702, 2: 0.0702, 3: 0.0702, 4: 0.0702},\n",
+ " 'car_type': {0: 'Toyota Sienna',1: 'Toyota Sienna',2: 'Toyota Sienna',3: 'Toyota Sienna',4: 'Toyota Sienna'}}\n",
+ "\n",
+ "df = pd.DataFrame(data = carLoans)\n",
+ "df"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Limitation of this Approach\n",
+ "If you have a larger dataset (like the entire payment table), it doesnt make sense to manually put data into a dataframe. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# this is painfully slow to type\n",
+ "carLoans = [\n",
+ " [1, 34689.96, 687.23, 202.93, 484.3, 34205.66, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [2, 34205.66, 687.23, 200.1, 487.13, 33718.53, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [3, 33718.53, 687.23, 197.25, 489.98, 33228.55, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [4, 33228.55, 687.23, 194.38, 492.85, 32735.7, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [5, 32735.7, 687.23, 191.5, 495.73, 32239.97, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [6, 32239.97, 687.23, 188.6, 498.63, 31741.34, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [7, 31741.34, 687.23, 185.68, 501.55, 31239.79, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [8, 31239.79, 687.23, 182.75, 504.48, 30735.31, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [9, 30735.31, 687.23, 179.8, 507.43, 30227.88, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [10, 30227.88, 687.23, 176.83, 510.4, 29717.48, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [11, 29717.48, 687.23, 173.84, 513.39, 29204.09, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [12, 29204.09, 687.23, 170.84, 516.39, 28687.7, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [13, 28687.7, 687.23, 167.82, 519.41, 28168.29, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [14, 28168.29, 687.23, 164.78, 522.45, 27645.84, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [15, 27645.84, 687.23, 161.72, 525.51, 27120.33, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [16, 27120.33, 687.23, 158.65, 528.58, 26591.75, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [17, 26591.75, 687.23, 155.56, 531.67, 26060.08, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [18, 26060.08, 687.23, 152.45, 534.78, 25525.3, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [19, 25525.3, 687.23, 149.32, 537.91, 24987.39, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [20, 24987.39, 687.23, 146.17, 541.06, 24446.33, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [21, 24446.33, 687.23, 143.01, 544.22, 23902.11, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [22, 23902.11, 687.23, 139.82, 547.41, 23354.7, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [23, 23354.7, 687.23, 136.62, 550.61, 22804.09, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [24, 22804.09, 687.23, 133.4, 553.83, 22250.26, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [25, 22250.26, 687.23, 130.16, 557.07, 21693.19, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [26, 21693.19, 687.23, 126.9, 560.33, 21132.86, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [27, 21132.86, 687.23, 123.62, 563.61, 20569.25, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [28, 20569.25, 687.23, 120.33, 566.9, 20002.35, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [29, 20002.35, 687.23, 117.01, 570.22, 19432.13, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [30, 19432.13, 687.23, 113.67, 573.56, 18858.57, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [31, 18858.57, 687.23, 110.32, 576.91, 18281.66, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [32, 18281.66, 687.23, 106.94, 580.29, 17701.37, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [33, 17701.37, 687.23, 103.55, 583.68, 17117.69, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [34, 17117.69, 687.23, 100.13, 587.1, 16530.59, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [35, 16530.59, 687.23, 96.7, 590.53, 15940.06, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [36, 15940.06, 687.23, 93.24, 593.99, 15346.07, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [37, 15346.07, 687.23, 89.77, 597.46, 14748.61, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [38, 14748.61, 687.23, 86.27, 600.96, 14147.65, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [39, 14147.65, 687.23, 82.76, 604.47, 13543.18, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [40, 13543.18, 687.23, 79.22, 608.01, 12935.17, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [41, 12935.17, 687.23, 75.67, 611.56, 12323.61, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [42, 12323.61, 687.23, 72.09, 615.14, 11708.47, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [43, 11708.47, 687.23, 68.49, 618.74, 11089.73, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [44, 11089.73, 687.23, 64.87, 622.36, 10467.37, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [45, 10467.37, 687.23, 61.23, 626.0, 9841.37, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [46, 9841.37, 687.23, 57.57, 629.66, 9211.71, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [47, 9211.71, 687.23, 53.88, 633.35, 8578.36, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [48, 8578.36, 687.23, 50.18, 637.05, 7941.31, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [49, 7941.31, 687.23, 46.45, 640.78, 7300.53, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [50, 7300.53, 687.23, 42.7, 644.53, 6656.0, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [51, 6656.0, 687.23, 38.93, 648.3, 6007.7, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [52, 6007.7, 687.23, 35.14, 652.09, 5355.61, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [53, 5355.61, 687.23, 31.33, 655.9, 4699.71, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [54, 4699.71, 687.23, 27.49, 659.74, 4039.97, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [55, 4039.97, 687.23, 23.63, 663.6, 3376.37, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [56, 3376.37, 687.23, 19.75, 667.48, 2708.89, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [57, 2708.89, 687.23, 15.84, 671.39, 2037.5, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [58, 2037.5, 687.23, 11.91, 675.32, 1362.18, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [59, 1362.18, 687.23, 7.96, 679.27, 682.91, 60, 0.0702, 'Toyota Sienna'],\n",
+ " [60, 682.91, 687.23, 3.99, 683.24, -0.33, 60, 0.0702, 'Toyota Sienna']\n",
+ " ]\n",
+ "\n",
+ "colNames = ['Month',\n",
+ " 'Starting Balance',\n",
+ " 'Repayment',\n",
+ " 'Interest Paid',\n",
+ " 'Principal Paid',\n",
+ " 'New Balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']\n",
+ "\n",
+ "df = pd.DataFrame(data = carLoans, columns=colNames)\n",
+ "df"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "help(pd.DataFrame)"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/ExportCSVExcel.ipynb b/Pandas/ExportCSVExcel.ipynb
new file mode 100755
index 0000000..f234ec7
--- /dev/null
+++ b/Pandas/ExportCSVExcel.ipynb
@@ -0,0 +1,212 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "if issues install conda install -c conda-forge openpyxl"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "interest_filter = df['interest_rate']==0.0702\n",
+ "df = df.loc[car_filter & interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# missing values can be excluded in calculations by default. \n",
+ "# excludes missing values in the calculation \n",
+ "interest_missing = df['interest_paid'].isna()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Fill in with the actual value\n",
+ "df.loc[interest_missing,'interest_paid'] = 93.24"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Export Pandas DataFrames to csv and excel files "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Export DataFrame to csv File\n",
+ "df.to_csv(path_or_buf='data/table_i702t60.csv',\n",
+ " index = True)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "If you get an error below, you probably need to install openpyxl or similar. \n",
+ "\n",
+ "stackoverflow: https://stackoverflow.com/questions/34509198/no-module-named-openpyxl-python-3-4-ubuntu\n",
+ "\n",
+ "`conda install openpyxl` or \n",
+ "\n",
+ "`conda install -c anaconda openpyxl`\n",
+ "`pip install openpyxl`"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# If you get the error below, try installing a library\n",
+ "# Export DataFrame to excel File\n",
+ "df.to_excel(excel_writer='data/table_i702t60.xlsx',\n",
+ " index=False)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Keep in mind that if you dont know a methods parameters,\n",
+ "# you can look them up using the help command. \n",
+ "help(df.to_csv)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "It is also good idea to check your exported files."
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/Filtering.ipynb b/Pandas/Filtering.ipynb
new file mode 100755
index 0000000..74d46f9
--- /dev/null
+++ b/Pandas/Filtering.ipynb
@@ -0,0 +1,246 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Filtering Data\n",
+ "Filter out the data to only have data `car_type` of 'Toyota Sienna' and `interest_rate` of 0.0702."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### car_type filter\n",
+ "Comparison Operator | Meaning\n",
+ "--- | --- \n",
+ "< | less than\n",
+ "<= | less than or equal to\n",
+ "> | greater than\n",
+ ">= | greater than or equal to\n",
+ "== | equal\n",
+ "!= | not equal"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Let's first start by looking at the car_type column. \n",
+ "df['car_type'].value_counts()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice that the filter produces a pandas series of True and False values\n",
+ "car_filter = df['car_type']=='Toyota Sienna'"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "car_filter.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 using square brackets\n",
+ "# Filter dataframe to get a DataFrame of only 'Toyota Sienna'\n",
+ "df[car_filter].head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 using loc\n",
+ "# Filter dataframe to get a DataFrame of only 'Toyota Sienna'\n",
+ "df.loc[car_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice that it looks like nothing changed\n",
+ "# This is because we didn't update the dataframe after applying the filter\n",
+ "df['car_type'].value_counts()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Filter dataframe to get a DataFrame of only 'Toyota Sienna'\n",
+ "df = df.loc[car_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['car_type'].value_counts()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### interest_rate Filter\n",
+ "Comparison Operator | Meaning\n",
+ "--- | --- \n",
+ "< | less than\n",
+ "<= | less than or equal to\n",
+ "> | greater than\n",
+ ">= | greater than or equal to\n",
+ "== | equal\n",
+ "!= | not equal"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['interest_rate'].value_counts()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice that the filter produces a pandas series of True and False values\n",
+ "df['interest_rate']==0.0702"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "interest_filter = df['interest_rate']==0.0702"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df = df.loc[interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['interest_rate'].value_counts(dropna = False)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Combining Filters\n",
+ "In the previous sections, we created `car_filter` and `interest_filter` and used the `loc` command to filter the data by first applying the `car_filter` and then the `interest_filter`. An more concise way to do it is shown below. \n",
+ "\n",
+ "Bitwise Logic Operator | Meaning\n",
+ "--- | --- \n",
+ "& | and\n",
+ "\\| | or\n",
+ "^ | exclusive or\n",
+ "~ | not"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.loc[car_filter & interest_filter, :]"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/IdentifyingMissingData.ipynb b/Pandas/IdentifyingMissingData.ipynb
new file mode 100755
index 0000000..76d9193
--- /dev/null
+++ b/Pandas/IdentifyingMissingData.ipynb
@@ -0,0 +1,222 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "interest_filter = df['interest_rate']==0.0702\n",
+ "df = df.loc[car_filter & interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Identifying Missing Data\n",
+ "Values will be originally missing from a dataset or be a product of data manipulation. In pandas, missing values are typically called `NaN` or `None`.\n",
+ "\n",
+ "Missing data can: \n",
+ "* Hint at data collection errors.\n",
+ "* Indicate improper conversion or manipulation.\n",
+ "* Actually not be considered missing. For some datasets, missing data can be listed as \"zero\", \"false\", \"not applicable\", \"entered an empty string\", among other possibilities. \n",
+ "\n",
+ "This is an important subject as before you can graph data, you should make sure you aren't trying to graph some missing values as that can cause an error or misinterpretation of the data. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Finding Missing Values"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.info()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Two common methods to indicate where values in a DataFrame are missing are `isna` and `isnull`. They are exactly the same methods, but with different names."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice we have a Pandas Series of True and False values\n",
+ "df['interest_paid'].isna().head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "interest_missing = df['interest_paid'].isna()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Looks at the row that contains the NaN for interest_paid\n",
+ "df.loc[interest_missing,:]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "# Keep in mind that we can use the not operator (~) to negate the filter\n",
+ "# every row that doesn't have a nan is returned.\n",
+ "df.loc[~interest_missing,:]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# The code counts the number of missing values\n",
+ "# sum() works because Booleans are a subtype of integers. \n",
+ "df['interest_paid'].isna().sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "True + False + False "
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/IntroPandas.ipynb b/Pandas/IntroPandas.ipynb
new file mode 100755
index 0000000..85b8935
--- /dev/null
+++ b/Pandas/IntroPandas.ipynb
@@ -0,0 +1,39 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Introduction to Pandas\n",
+ "This lesson, outlines techniques for effectively loading, storing, manipulating, and exporting in-memory data in Python. In order to make apply a machine learning algorithm or even make a visualization, we need data and it helps to have it in an organized tablular form.\n",
+ "The pandas library provides easy-to-use data structures and data analysis tools that you can use to clean and understand your data.\n",
+ "\n",
+ "An important data structure of the pandas library is a fast and efficient object for data manipulation called a `DataFrame`. \n",
+ "\n",
+ ""
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/LoadData.ipynb b/Pandas/LoadData.ipynb
new file mode 100755
index 0000000..1693213
--- /dev/null
+++ b/Pandas/LoadData.ipynb
@@ -0,0 +1,114 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Load Data "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Load CSV File\n",
+ "In this part of the video we are loading a file and just assuming it is loading properly. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load car loan data from a csv file\n",
+ "filename = 'data/car_financing.csv'\n",
+ "df = pd.read_csv(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Load Excel File"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "help(pd.read_excel)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/RemoveFillMissingData.ipynb b/Pandas/RemoveFillMissingData.ipynb
new file mode 100755
index 0000000..d6723ec
--- /dev/null
+++ b/Pandas/RemoveFillMissingData.ipynb
@@ -0,0 +1,389 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load Excel File\n",
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "#interest_filter = df['interest_rate']==0.0702\n",
+ "car_filter"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.loc[car_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "## Filtering \n",
+ "car_filter = df['car_type']=='Toyota Sienna'\n",
+ "interest_filter = df['interest_rate']==0.0702\n",
+ "df = df.loc[car_filter & interest_filter, :]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Removing or Filling in Missing Data\n",
+ "This is an important subject as before you can graph data, you should make sure you aren't trying to graph some missing values as that can cause an error or misinterpretation of the data. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.info()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['interest_paid'].value_counts(dropna = False)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "help(df['interest_paid'].value_counts)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Remove Missing Values\n",
+ "You can remove missing values by using the `dropna` method. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.isnull().sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df[30:40]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "# You can drop entire rows if they contain 'any' nans in them or 'all'\n",
+ "# this may not be the best strategy for our dataset\n",
+ "df[30:40].dropna(how = 'any')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Filling in Missing Values\n",
+ "There are a [variety of ways to fill in missing values](https://pandas.pydata.org/pandas-docs/stable/user_guide/missing_data.html). "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Looking at where missing data is located\n",
+ "df['interest_paid'][30:40]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Filling in the nan with a zero is probably a bad idea. \n",
+ "df['interest_paid'][30:40].fillna(0)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# back fill in value\n",
+ "df['interest_paid'][30:40].fillna(method='bfill')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# forward fill in value\n",
+ "df['interest_paid'][30:40].fillna(method='ffill')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# linear interpolation (filling in of values)\n",
+ "df['interest_paid'][30:40].interpolate(method = 'linear')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Interest paid before filling in the nan with a value\n",
+ "df['interest_paid'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Fill in with the actual value\n",
+ "interest_missing = df['interest_paid'].isna()\n",
+ "df.loc[interest_missing,'interest_paid'] = 93.24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Interest paid after filling in the nan with a value\n",
+ "df['interest_paid'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Notice we dont have NaN values in the DataFrame anymore\n",
+ "df.info()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# not null\n",
+ "notNullFilter = ~df['interest_paid'].isnull()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.loc[notNullFilter, :]"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/RenamingDeletingColumns.ipynb b/Pandas/RenamingDeletingColumns.ipynb
new file mode 100755
index 0000000..9ad400f
--- /dev/null
+++ b/Pandas/RenamingDeletingColumns.ipynb
@@ -0,0 +1,196 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Load Excel File"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Renaming and Deleting Columns\n",
+ "It is often the case where you change your column names or remove unnecessary columns."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Rename columns"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Here are two popular ways to rename dataframe columns.\n",
+ "1. dictionary substitution: very useful if you only want to rename a few of the columns.\n",
+ "2. list replacement: requires a full list of names (in my experience, this is more error prone)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# DataFrame before renaming columns\n",
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# This wont work as there is a space in the column name\n",
+ "# I want to fix that\n",
+ "df['Principal Paid']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1 dictionary substitution using rename method\n",
+ "df = df.rename(columns={'Starting Balance': 'starting_balance',\n",
+ " 'Interest Paid': 'interest_paid', \n",
+ " 'Principal Paid': 'principal_paid',\n",
+ " 'New Balance': 'new_balance'})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# DataFrame after renaming columns\n",
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 list replacement\n",
+ "# Only changing Month -> month, but we need to list the rest of the columns\n",
+ "df.columns = ['month',\n",
+ " 'starting_balance',\n",
+ " 'Repayment',\n",
+ " 'interest_paid',\n",
+ " 'principal_paid',\n",
+ " 'new_balance',\n",
+ " 'term',\n",
+ " 'interest_rate',\n",
+ " 'car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Deleting Columns"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 1\n",
+ "# This approach allows you to drop multiple columns at a time \n",
+ "df = df.drop(columns=['term'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Approach 2 use the del command\n",
+ "del df['Repayment']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/Slicing.ipynb b/Pandas/Slicing.ipynb
new file mode 100755
index 0000000..68ad1e9
--- /dev/null
+++ b/Pandas/Slicing.ipynb
@@ -0,0 +1,256 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Load Excel File"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "filename = 'data/car_financing.xlsx'\n",
+ "df = pd.read_excel(filename)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Slicing\n",
+ "1. How to select columns in pandas \n",
+ "2. How to use slicing operations in pandas"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Select columns using brackets\n",
+ "With square brackets, you can select one or more columns."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select one column using double brackets\n",
+ "df[['car_type']].head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select multiple columns using double brackets\n",
+ "df[['car_type', 'Principal Paid']].head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# This is a Pandas DataFrame\n",
+ "type(df[['car_type']].head())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select one column using single brackets\n",
+ "# This produces a pandas series which is a one-dimensional array which can be labeled\n",
+ "df['car_type'].head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# This is a pandas series\n",
+ "type(df['car_type'].head())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Keep in mind that you can't select multiple colums using single brackets\n",
+ "# This will result in a KeyError\n",
+ "df['car_type', 'Principal Paid']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df[['car_type', 'Principal Paid']]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Pandas Slicing"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "With a pandas series, we can select rows using slicing like this: series[start_index:end_index]\n",
+ "\n",
+ "The end_index is not inclusive. This behavior is very similar to Python lists."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['car_type']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['car_type'][0:10]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Select column using dot notation. \n",
+ "# This is not recommended.\n",
+ "df.car_type.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "\"\"\"\n",
+ "This won't work as there is a space in the column name. \n",
+ "Dot notation also fails if your column has the same name \n",
+ "of a DataFrame's attributes or methods.\n",
+ "\"\"\"\n",
+ "df.Principal Paid"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df['Principal Paid']"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Selecting Columns using loc\n",
+ "The pandas attribute .loc allow you to select columns, index, and slice your data. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# pandas dataframe\n",
+ "df.loc[:, ['car_type']].head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# pandas series\n",
+ "df.loc[:, 'car_type'].head()"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/Pandas/data/.DS_Store b/Pandas/data/.DS_Store
new file mode 100755
index 0000000..1ec13c3
Binary files /dev/null and b/Pandas/data/.DS_Store differ
diff --git a/Pandas/data/car_financing.csv b/Pandas/data/car_financing.csv
new file mode 100755
index 0000000..b7ead25
--- /dev/null
+++ b/Pandas/data/car_financing.csv
@@ -0,0 +1,409 @@
+Month,Starting Balance,Repayment,Interest Paid,Principal Paid,New Balance,term,interest_rate,car_type
+1,34689.96,687.23,202.93,484.3,34205.66,60,0.0702,Toyota Sienna
+2,34205.66,687.23,200.1,487.13,33718.53,60,0.0702,Toyota Sienna
+3,33718.53,687.23,197.25,489.98,33228.55,60,0.0702,Toyota Sienna
+4,33228.55,687.23,194.38,492.85,32735.7,60,0.0702,Toyota Sienna
+5,32735.7,687.23,191.5,495.73,32239.97,60,0.0702,Toyota Sienna
+6,32239.97,687.23,188.6,498.63,31741.34,60,0.0702,Toyota Sienna
+7,31741.34,687.23,185.68,501.55,31239.79,60,0.0702,Toyota Sienna
+8,31239.79,687.23,182.75,504.48,30735.31,60,0.0702,Toyota Sienna
+9,30735.31,687.23,179.8,507.43,30227.88,60,0.0702,Toyota Sienna
+10,30227.88,687.23,176.83,510.4,29717.48,60,0.0702,Toyota Sienna
+11,29717.48,687.23,173.84,513.39,29204.09,60,0.0702,Toyota Sienna
+12,29204.09,687.23,170.84,516.39,28687.7,60,0.0702,Toyota Sienna
+13,28687.7,687.23,167.82,519.41,28168.29,60,0.0702,Toyota Sienna
+14,28168.29,687.23,164.78,522.45,27645.84,60,0.0702,Toyota Sienna
+15,27645.84,687.23,161.72,525.51,27120.33,60,0.0702,Toyota Sienna
+16,27120.33,687.23,158.65,528.58,26591.75,60,0.0702,Toyota Sienna
+17,26591.75,687.23,155.56,531.67,26060.08,60,0.0702,Toyota Sienna
+18,26060.08,687.23,152.45,534.78,25525.3,60,0.0702,Toyota Sienna
+19,25525.3,687.23,149.32,537.91,24987.39,60,0.0702,Toyota Sienna
+20,24987.39,687.23,146.17,541.06,24446.33,60,0.0702,Toyota Sienna
+21,24446.33,687.23,143.01,544.22,23902.11,60,0.0702,Toyota Sienna
+22,23902.11,687.23,139.82,547.41,23354.7,60,0.0702,Toyota Sienna
+23,23354.7,687.23,136.62,550.61,22804.09,60,0.0702,Toyota Sienna
+24,22804.09,687.23,133.4,553.83,22250.26,60,0.0702,Toyota Sienna
+25,22250.26,687.23,130.16,557.07,21693.19,60,0.0702,Toyota Sienna
+26,21693.19,687.23,126.9,560.33,21132.86,60,0.0702,Toyota Sienna
+27,21132.86,687.23,123.62,563.61,20569.25,60,0.0702,Toyota Sienna
+28,20569.25,687.23,120.33,566.9,20002.35,60,0.0702,Toyota Sienna
+29,20002.35,687.23,117.01,570.22,19432.13,60,0.0702,Toyota Sienna
+30,19432.13,687.23,113.67,573.56,18858.57,60,0.0702,Toyota Sienna
+31,18858.57,687.23,110.32,576.91,18281.66,60,0.0702,Toyota Sienna
+32,18281.66,687.23,106.94,580.29,17701.37,60,0.0702,Toyota Sienna
+33,17701.37,687.23,103.55,583.68,17117.69,60,0.0702,Toyota Sienna
+34,17117.69,687.23,100.13,587.1,16530.59,60,0.0702,Toyota Sienna
+35,16530.59,687.23,96.7,590.53,15940.06,60,0.0702,Toyota Sienna
+36,15940.06,687.23,93.24,593.99,15346.07,60,0.0702,Toyota Sienna
+37,15346.07,687.23,89.77,597.46,14748.61,60,0.0702,Toyota Sienna
+38,14748.61,687.23,86.27,600.96,14147.65,60,0.0702,Toyota Sienna
+39,14147.65,687.23,82.76,604.47,13543.18,60,0.0702,Toyota Sienna
+40,13543.18,687.23,79.22,608.01,12935.17,60,0.0702,Toyota Sienna
+41,12935.17,687.23,75.67,611.56,12323.61,60,0.0702,Toyota Sienna
+42,12323.61,687.23,72.09,615.14,11708.47,60,0.0702,Toyota Sienna
+43,11708.47,687.23,68.49,618.74,11089.73,60,0.0702,Toyota Sienna
+44,11089.73,687.23,64.87,622.36,10467.37,60,0.0702,Toyota Sienna
+45,10467.37,687.23,61.23,626.0,9841.37,60,0.0702,Toyota Sienna
+46,9841.37,687.23,57.57,629.66,9211.71,60,0.0702,Toyota Sienna
+47,9211.71,687.23,53.88,633.35,8578.36,60,0.0702,Toyota Sienna
+48,8578.36,687.23,50.18,637.05,7941.31,60,0.0702,Toyota Sienna
+49,7941.31,687.23,46.45,640.78,7300.53,60,0.0702,Toyota Sienna
+50,7300.53,687.23,42.7,644.53,6656.0,60,0.0702,Toyota Sienna
+51,6656.0,687.23,38.93,648.3,6007.7,60,0.0702,Toyota Sienna
+52,6007.7,687.23,35.14,652.09,5355.61,60,0.0702,Toyota Sienna
+53,5355.61,687.23,31.33,655.9,4699.71,60,0.0702,Toyota Sienna
+54,4699.71,687.23,27.49,659.74,4039.97,60,0.0702,Toyota Sienna
+55,4039.97,687.23,23.63,663.6,3376.37,60,0.0702,Toyota Sienna
+56,3376.37,687.23,19.75,667.48,2708.89,60,0.0702,Toyota Sienna
+57,2708.89,687.23,15.84,671.39,2037.5,60,0.0702,Toyota Sienna
+58,2037.5,687.23,11.91,675.32,1362.18,60,0.0702,Toyota Sienna
+59,1362.18,687.23,7.96,679.27,682.91,60,0.0702,Toyota Sienna
+60,682.91,687.23,3.99,683.24,-0.33,60,0.0702,Toyota Sienna
+1,34689.96,632.47,103.78,528.69,34161.27,60,0.0359,Toyota Sienna
+2,34161.27,632.47,102.19,530.28,33630.99,60,0.0359,Toyota Sienna
+3,33630.99,632.47,100.61,531.86,33099.13,60,0.0359,Toyota Sienna
+4,33099.13,632.47,99.02,533.45,32565.68,60,0.0359,Toyota Sienna
+5,32565.68,632.47,97.42,535.05,32030.63,60,0.0359,Toyota Sienna
+6,32030.63,632.47,95.82,536.65,31493.98,60,0.0359,Toyota Sienna
+7,31493.98,632.47,94.21,538.26,30955.72,60,0.0359,Toyota Sienna
+8,30955.72,632.47,92.6,539.87,30415.85,60,0.0359,Toyota Sienna
+9,30415.85,632.47,90.99,541.48,29874.37,60,0.0359,Toyota Sienna
+10,29874.37,632.47,89.37,543.1,29331.27,60,0.0359,Toyota Sienna
+11,29331.27,632.47,87.74,544.73,28786.54,60,0.0359,Toyota Sienna
+12,28786.54,632.47,86.11,546.36,28240.18,60,0.0359,Toyota Sienna
+13,28240.18,632.47,84.48,547.99,27692.19,60,0.0359,Toyota Sienna
+14,27692.19,632.47,82.84,549.63,27142.56,60,0.0359,Toyota Sienna
+15,27142.56,632.47,81.2,551.27,26591.29,60,0.0359,Toyota Sienna
+16,26591.29,632.47,79.55,552.92,26038.37,60,0.0359,Toyota Sienna
+17,26038.37,632.47,77.89,554.58,25483.79,60,0.0359,Toyota Sienna
+18,25483.79,632.47,76.23,556.24,24927.55,60,0.0359,Toyota Sienna
+19,24927.55,632.47,74.57,557.9,24369.65,60,0.0359,Toyota Sienna
+20,24369.65,632.47,72.9,559.57,23810.08,60,0.0359,Toyota Sienna
+21,23810.08,632.47,71.23,561.24,23248.84,60,0.0359,Toyota Sienna
+22,23248.84,632.47,69.55,562.92,22685.92,60,0.0359,Toyota Sienna
+23,22685.92,632.47,67.86,564.61,22121.31,60,0.0359,Toyota Sienna
+24,22121.31,632.47,66.17,566.3,21555.01,60,0.0359,Toyota Sienna
+25,21555.01,632.47,64.48,567.99,20987.02,60,0.0359,Toyota Sienna
+26,20987.02,632.47,62.78,569.69,20417.33,60,0.0359,Toyota Sienna
+27,20417.33,632.47,61.08,571.39,19845.94,60,0.0359,Toyota Sienna
+28,19845.94,632.47,59.37,573.1,19272.84,60,0.0359,Toyota Sienna
+29,19272.84,632.47,57.65,574.82,18698.02,60,0.0359,Toyota Sienna
+30,18698.02,632.47,55.93,576.54,18121.48,60,0.0359,Toyota Sienna
+31,18121.48,632.47,54.21,578.26,17543.22,60,0.0359,Toyota Sienna
+32,17543.22,632.47,52.48,579.99,16963.23,60,0.0359,Toyota Sienna
+33,16963.23,632.47,50.74,581.73,16381.5,60,0.0359,Toyota Sienna
+34,16381.5,632.47,49.0,583.47,15798.03,60,0.0359,Toyota Sienna
+35,15798.03,632.47,47.26,585.21,15212.82,60,0.0359,Toyota Sienna
+36,15212.82,632.47,45.51,586.96,14625.86,60,0.0359,Toyota Sienna
+37,14625.86,632.47,43.75,588.72,14037.14,60,0.0359,Toyota Sienna
+38,14037.14,632.47,41.99,590.48,13446.66,60,0.0359,Toyota Sienna
+39,13446.66,632.47,40.22,592.25,12854.41,60,0.0359,Toyota Sienna
+40,12854.41,632.47,38.45,594.02,12260.39,60,0.0359,Toyota Sienna
+41,12260.39,632.47,36.67,595.8,11664.59,60,0.0359,Toyota Sienna
+42,11664.59,632.47,34.89,597.58,11067.01,60,0.0359,Toyota Sienna
+43,11067.01,632.47,33.1,599.37,10467.64,60,0.0359,Toyota Sienna
+44,10467.64,632.47,31.31,601.16,9866.48,60,0.0359,Toyota Sienna
+45,9866.48,632.47,29.51,602.96,9263.52,60,0.0359,Toyota Sienna
+46,9263.52,632.47,27.71,604.76,8658.76,60,0.0359,Toyota Sienna
+47,8658.76,632.47,25.9,606.57,8052.19,60,0.0359,Toyota Sienna
+48,8052.19,632.47,24.08,608.39,7443.8,60,0.0359,Toyota Sienna
+49,7443.8,632.47,22.26,610.21,6833.59,60,0.0359,Toyota Sienna
+50,6833.59,632.47,20.44,612.03,6221.56,60,0.0359,Toyota Sienna
+51,6221.56,632.47,18.61,613.86,5607.7,60,0.0359,Toyota Sienna
+52,5607.7,632.47,16.77,615.7,4992.0,60,0.0359,Toyota Sienna
+53,4992.0,632.47,14.93,617.54,4374.46,60,0.0359,Toyota Sienna
+54,4374.46,632.47,13.08,619.39,3755.07,60,0.0359,Toyota Sienna
+55,3755.07,632.47,11.23,621.24,3133.83,60,0.0359,Toyota Sienna
+56,3133.83,632.47,9.37,623.1,2510.73,60,0.0359,Toyota Sienna
+57,2510.73,632.47,7.51,624.96,1885.77,60,0.0359,Toyota Sienna
+58,1885.77,632.47,5.64,626.83,1258.94,60,0.0359,Toyota Sienna
+59,1258.94,632.47,3.76,628.71,630.23,60,0.0359,Toyota Sienna
+60,630.23,632.47,1.88,630.59,-0.36,60,0.0359,Toyota Sienna
+1,21600.0,636.76,70.2,566.56,21033.44,36,0.039,Toyota Corolla
+2,21033.44,636.76,68.35,568.41,20465.03,36,0.039,Toyota Corolla
+3,20465.03,636.76,66.51,570.25,19894.78,36,0.039,Toyota Corolla
+4,19894.78,636.76,64.65,572.11,19322.67,36,0.039,Toyota Corolla
+5,19322.67,636.76,62.79,573.97,18748.7,36,0.039,Toyota Corolla
+6,18748.7,636.76,60.93,575.83,18172.87,36,0.039,Toyota Corolla
+7,18172.87,636.76,59.06,577.7,17595.17,36,0.039,Toyota Corolla
+8,17595.17,636.76,57.18,579.58,17015.59,36,0.039,Toyota Corolla
+9,17015.59,636.76,55.3,581.46,16434.13,36,0.039,Toyota Corolla
+10,16434.13,636.76,53.41,583.35,15850.78,36,0.039,Toyota Corolla
+11,15850.78,636.76,51.51,585.25,15265.53,36,0.039,Toyota Corolla
+12,15265.53,636.76,49.61,587.15,14678.38,36,0.039,Toyota Carolla
+13,14678.38,636.76,47.7,589.06,14089.32,36,0.039,Toyota Corolla
+14,14089.32,636.76,45.79,590.97,13498.35,36,0.039,Toyota Corolla
+15,13498.35,636.76,43.86,592.9,12905.45,36,0.039,Toyota Corolla
+16,12905.45,636.76,41.94,594.82,12310.63,36,0.039,Toyota Corolla
+17,12310.63,636.76,40.0,596.76,11713.87,36,0.039,Toyota Corolla
+18,11713.87,636.76,38.07,598.69,11115.18,36,0.039,Toyota Corolla
+19,11115.18,636.76,36.12,600.64,10514.54,36,0.039,Toyota Corolla
+20,10514.54,636.76,34.17,602.59,9911.95,36,0.039,Toyota Corolla
+21,9911.95,636.76,32.21,604.55,9307.4,36,0.039,Toyota Carolla
+22,9307.4,636.76,30.24,606.52,8700.88,36,0.039,Toyota Corolla
+23,8700.88,636.76,28.27,608.49,8092.39,36,0.039,Toyota Corolla
+24,8092.39,636.76,26.3,610.46,7481.93,36,0.039,Toyota Corolla
+25,7481.93,636.76,24.31,612.45,6869.48,36,0.039,Toyota Corolla
+26,6869.48,636.76,22.32,614.44,6255.04,36,0.039,Toyota Corolla
+27,6255.04,636.76,20.32,616.44,5638.6,36,0.039,Toyota Corolla
+28,5638.6,636.76,18.32,618.44,5020.16,36,0.039,Toyota Corolla
+29,5020.16,636.76,16.31,620.45,4399.71,36,0.039,Toyota Corolla
+30,4399.71,636.76,14.29,622.47,3777.24,36,0.039,Toyota Corolla
+31,3777.24,636.76,12.27,624.49,3152.75,36,0.039,Toyota Carolla
+32,3152.75,636.76,10.24,626.52,2526.23,36,0.039,Toyota Corolla
+33,2526.23,636.76,8.21,628.55,1897.68,36,0.039,Toyota Corolla
+34,1897.68,636.76,6.16,630.6,1267.08,36,0.039,Toyota Corolla
+35,1267.08,636.76,4.11,632.65,634.43,36,0.039,Toyota Corolla
+36,634.43,636.76,2.06,634.7,-0.27,36,0.039,Toyota Corolla
+1,21600.0,486.74,70.2,416.54,21183.46,48,0.039,Toyota Carolla
+2,21183.46,486.74,68.84,417.9,20765.56,48,0.039,Toyota Carolla
+3,20765.56,486.74,67.48,419.26,20346.3,48,0.039,Toyota Carolla
+4,20346.3,486.74,66.12,420.62,19925.68,48,0.039,Toyota Carolla
+5,19925.68,486.74,64.75,421.99,19503.69,48,0.039,Toyota Carolla
+6,19503.69,486.74,63.38,423.36,19080.33,48,0.039,Toyota Carolla
+7,19080.33,486.74,62.01,424.73,18655.6,48,0.039,Toyota Carolla
+8,18655.6,486.74,60.63,426.11,18229.49,48,0.039,Toyota Carolla
+9,18229.49,486.74,59.24,427.5,17801.99,48,0.039,Toyota Carolla
+10,17801.99,486.74,57.85,428.89,17373.1,48,0.039,Toyota Carolla
+11,17373.1,486.74,56.46,430.28,16942.82,48,0.039,Toyota Carolla
+12,16942.82,486.74,55.06,431.68,16511.14,48,0.039,Toyota Carolla
+13,16511.14,486.74,53.66,433.08,16078.06,48,0.039,Toyota Carolla
+14,16078.06,486.74,52.25,434.49,15643.57,48,0.039,Toyota Carolla
+15,15643.57,486.74,50.84,435.9,15207.67,48,0.039,Toyota Carolla
+16,15207.67,486.74,49.42,437.32,14770.35,48,0.039,Toyota Carolla
+17,14770.35,486.74,48.0,438.74,14331.61,48,0.039,Toyota Carolla
+18,14331.61,486.74,46.57,440.17,13891.44,48,0.039,Toyota Carolla
+19,13891.44,486.74,45.14,441.6,13449.84,48,0.039,Toyota Carolla
+20,13449.84,486.74,43.71,443.03,13006.81,48,0.039,Toyota Carolla
+21,13006.81,486.74,42.27,444.47,12562.34,48,0.039,Toyota Carolla
+22,12562.34,486.74,40.82,445.92,12116.42,48,0.039,Toyota Carolla
+23,12116.42,486.74,39.37,447.37,11669.05,48,0.039,Toyota Carolla
+24,11669.05,486.74,37.92,448.82,11220.23,48,0.039,Toyota Carolla
+25,11220.23,486.74,36.46,450.28,10769.95,48,0.039,Toyota Carolla
+26,10769.95,486.74,35.0,451.74,10318.21,48,0.039,Toyota Carolla
+27,10318.21,486.74,33.53,453.21,9865.0,48,0.039,Toyota Carolla
+28,9865.0,486.74,32.06,454.68,9410.32,48,0.039,Toyota Carolla
+29,9410.32,486.74,30.58,456.16,8954.16,48,0.039,Toyota Carolla
+30,8954.16,486.74,29.1,457.64,8496.52,48,0.039,Toyota Carolla
+31,8496.52,486.74,27.61,459.13,8037.39,48,0.039,Toyota Carolla
+32,8037.39,486.74,26.12,460.62,7576.77,48,0.039,Toyota Carolla
+33,7576.77,486.74,24.62,462.12,7114.65,48,0.039,Toyota Carolla
+34,7114.65,486.74,23.12,463.62,6651.03,48,0.039,Toyota Carolla
+35,6651.03,486.74,21.61,465.13,6185.9,48,0.039,Toyota Carolla
+36,6185.9,486.74,20.1,466.64,5719.26,48,0.039,Toyota Carolla
+37,5719.26,486.74,18.58,468.16,5251.1,48,0.039,Toyota Carolla
+38,5251.1,486.74,17.06,469.68,4781.42,48,0.039,Toyota Carolla
+39,4781.42,486.74,15.53,471.21,4310.21,48,0.039,Toyota Carolla
+40,4310.21,486.74,14.0,472.74,3837.47,48,0.039,Toyota Carolla
+41,3837.47,486.74,12.47,474.27,3363.2,48,0.039,Toyota Carolla
+42,3363.2,486.74,10.93,475.81,2887.39,48,0.039,Toyota Carolla
+43,2887.39,486.74,9.38,477.36,2410.03,48,0.039,Toyota Carolla
+44,2410.03,486.74,7.83,478.91,1931.12,48,0.039,Toyota Carolla
+45,1931.12,486.74,6.27,480.47,1450.65,48,0.039,Toyota Carolla
+46,1450.65,486.74,4.71,482.03,968.62,48,0.039,Toyota Carolla
+47,968.62,486.74,3.14,483.6,485.02,48,0.039,Toyota Carolla
+48,485.02,486.74,1.57,485.17,-0.15,48,0.039,Toyota Carolla
+1,21600.0,396.82,70.2,326.62,21273.38,60,0.039,Toyota Carolla
+2,21273.38,396.82,69.13,327.69,20945.69,60,0.039,Toyota Carolla
+3,20945.69,396.82,68.07,328.75,20616.94,60,0.039,Toyota Carolla
+4,20616.94,396.82,67.0,329.82,20287.12,60,0.039,Toyota Carolla
+5,20287.12,396.82,65.93,330.89,19956.23,60,0.039,Toyota Carolla
+6,19956.23,396.82,64.85,331.97,19624.26,60,0.039,Toyota Carolla
+7,19624.26,396.82,63.77,333.05,19291.21,60,0.039,Toyota Carolla
+8,19291.21,396.82,62.69,334.13,18957.08,60,0.039,Toyota Carolla
+9,18957.08,396.82,61.61,335.21,18621.87,60,0.039,Toyota Carolla
+10,18621.87,396.82,60.52,336.3,18285.57,60,0.039,Toyota Carolla
+11,18285.57,396.82,59.42,337.4,17948.17,60,0.039,Toyota Carolla
+12,17948.17,396.82,58.33,338.49,17609.68,60,0.039,Toyota Carolla
+13,17609.68,396.82,57.23,339.59,17270.09,60,0.039,Toyota Carolla
+14,17270.09,396.82,56.12,340.7,16929.39,60,0.039,Toyota Carolla
+15,16929.39,396.82,55.02,341.8,16587.59,60,0.039,Toyota Carolla
+16,16587.59,396.82,53.9,342.92,16244.67,60,0.039,Toyota Carolla
+17,16244.67,396.82,52.79,344.03,15900.64,60,0.039,Toyota Carolla
+18,15900.64,396.82,51.67,345.15,15555.49,60,0.039,Toyota Carolla
+19,15555.49,396.82,50.55,346.27,15209.22,60,0.039,Toyota Carolla
+20,15209.22,396.82,49.42,347.4,14861.82,60,0.039,Toyota Carolla
+21,14861.82,396.82,48.3,348.52,14513.3,60,0.039,Toyota Carolla
+22,14513.3,396.82,47.16,349.66,14163.64,60,0.039,Toyota Carolla
+23,14163.64,396.82,46.03,350.79,13812.85,60,0.039,Toyota Carolla
+24,13812.85,396.82,44.89,351.93,13460.92,60,0.039,Toyota Carolla
+25,13460.92,396.82,43.74,353.08,13107.84,60,0.039,Toyota Carolla
+26,13107.84,396.82,42.6,354.22,12753.62,60,0.039,Toyota Carolla
+27,12753.62,396.82,41.44,355.38,12398.24,60,0.039,Toyota Carolla
+28,12398.24,396.82,40.29,356.53,12041.71,60,0.039,Toyota Carolla
+29,12041.71,396.82,39.13,357.69,11684.02,60,0.039,Toyota Carolla
+30,11684.02,396.82,37.97,358.85,11325.17,60,0.039,Toyota Carolla
+31,11325.17,396.82,36.8,360.02,10965.15,60,0.039,Toyota Carolla
+32,10965.15,396.82,35.63,361.19,10603.96,60,0.039,Toyota Carolla
+33,10603.96,396.82,34.46,362.36,10241.6,60,0.039,Toyota Carolla
+34,10241.6,396.82,33.28,363.54,9878.06,60,0.039,Toyota Carolla
+35,9878.06,396.82,32.1,364.72,9513.34,60,0.039,Toyota Carolla
+36,9513.34,396.82,30.91,365.91,9147.43,60,0.039,Toyota Carolla
+37,9147.43,396.82,29.72,367.1,8780.33,60,0.039,Toyota Carolla
+38,8780.33,396.82,28.53,368.29,8412.04,60,0.039,Toyota Carolla
+39,8412.04,396.82,27.33,369.49,8042.55,60,0.039,Toyota Carolla
+40,8042.55,396.82,26.13,370.69,7671.86,60,0.039,Toyota Carolla
+41,7671.86,396.82,24.93,371.89,7299.97,60,0.039,Toyota Carolla
+42,7299.97,396.82,23.72,373.1,6926.87,60,0.039,Toyota Carolla
+43,6926.87,396.82,22.51,374.31,6552.56,60,0.039,Toyota Carolla
+44,6552.56,396.82,21.29,375.53,6177.03,60,0.039,Toyota Carolla
+45,6177.03,396.82,20.07,376.75,5800.28,60,0.039,Toyota Carolla
+46,5800.28,396.82,18.85,377.97,5422.31,60,0.039,Toyota Carolla
+47,5422.31,396.82,17.62,379.2,5043.11,60,0.039,Toyota Carolla
+48,5043.11,396.82,16.39,380.43,4662.68,60,0.039,Toyota Carolla
+49,4662.68,396.82,15.15,381.67,4281.01,60,0.039,Toyota Carolla
+50,4281.01,396.82,13.91,382.91,3898.1,60,0.039,Toyota Carolla
+51,3898.1,396.82,12.66,384.16,3513.94,60,0.039,Toyota Carolla
+52,3513.94,396.82,11.42,385.4,3128.54,60,0.039,Toyota Carolla
+53,3128.54,396.82,10.16,386.66,2741.88,60,0.039,Toyota Carolla
+54,2741.88,396.82,8.91,387.91,2353.97,60,0.039,Toyota Carolla
+55,2353.97,396.82,7.65,389.17,1964.8,60,0.039,Toyota Carolla
+56,1964.8,396.82,6.38,390.44,1574.36,60,0.039,Toyota Carolla
+57,1574.36,396.82,5.11,391.71,1182.65,60,0.039,Toyota Carolla
+58,1182.65,396.82,3.84,392.98,789.67,60,0.039,Toyota Carolla
+59,789.67,396.82,2.56,394.26,395.41,60,0.039,Toyota Carolla
+60,395.41,396.82,1.28,395.54,-0.13,60,0.039,Toyota Carolla
+1,44409.6,1289.53,107.32,1182.21,43227.39,36,0.029,VW Golf R
+2,43227.39,1289.53,104.46,1185.07,42042.32,36,0.029,VW Golf R
+3,42042.32,1289.53,101.6,1187.93,40854.39,36,0.029,VW Golf R
+4,40854.39,1289.53,98.73,1190.8,39663.59,36,0.029,VW Golf R
+5,39663.59,1289.53,95.85,1193.68,38469.91,36,0.029,VW Golf R
+6,38469.91,1289.53,92.96,1196.57,37273.34,36,0.029,VW Golf R
+7,37273.34,1289.53,90.07,1199.46,36073.88,36,0.029,VW Golf R
+8,36073.88,1289.53,87.17,1202.36,34871.52,36,0.029,VW Golf R
+9,34871.52,1289.53,84.27,1205.26,33666.26,36,0.029,VW Golf R
+10,33666.26,1289.53,81.36,1208.17,32458.09,36,0.029,VW Golf R
+11,32458.09,1289.53,78.44,1211.09,31247.0,36,0.029,VW Golf R
+12,31247.0,1289.53,75.51,1214.02,30032.98,36,0.029,VW Golf R
+13,30032.98,1289.53,72.57,1216.96,28816.02,36,0.029,VW Golf R
+14,28816.02,1289.53,69.63,1219.9,27596.12,36,0.029,VW Golf R
+15,27596.12,1289.53,66.69,1222.84,26373.28,36,0.029,VW Golf R
+16,26373.28,1289.53,63.73,1225.8,25147.48,36,0.029,VW Golf R
+17,25147.48,1289.53,60.77,1228.76,23918.72,36,0.029,VW Golf R
+18,23918.72,1289.53,57.8,1231.73,22686.99,36,0.029,VW Golf R
+19,22686.99,1289.53,54.82,1234.71,21452.28,36,0.029,VW Golf R
+20,21452.28,1289.53,51.84,1237.69,20214.59,36,0.029,VW Golf R
+21,20214.59,1289.53,48.85,1240.68,18973.91,36,0.029,VW Golf R
+22,18973.91,1289.53,45.85,1243.68,17730.23,36,0.029,VW Golf R
+23,17730.23,1289.53,42.84,1246.69,16483.54,36,0.029,VW Golf R
+24,16483.54,1289.53,39.83,1249.7,15233.84,36,0.029,VW Golf R
+25,15233.84,1289.53,36.81,1252.72,13981.12,36,0.029,VW Golf R
+26,13981.12,1289.53,33.78,1255.75,12725.37,36,0.029,VW Golf R
+27,12725.37,1289.53,30.75,1258.78,11466.59,36,0.029,VW Golf R
+28,11466.59,1289.53,27.71,1261.82,10204.77,36,0.029,VW Golf R
+29,10204.77,1289.53,24.66,1264.87,8939.9,36,0.029,VW Golf R
+30,8939.9,1289.53,21.6,1267.93,7671.97,36,0.029,VW Golf R
+31,7671.97,1289.53,18.54,1270.99,6400.98,36,0.029,VW Golf R
+32,6400.98,1289.53,15.46,1274.07,5126.91,36,0.029,VW Golf R
+33,5126.91,1289.53,12.39,1277.14,3849.77,36,0.029,VW Golf R
+34,3849.77,1289.53,9.3,1280.23,2569.54,36,0.029,VW Golf R
+35,2569.54,1289.53,6.2,1283.33,1286.21,36,0.029,VW Golf R
+36,1286.21,1289.53,3.1,1286.43,-0.22,36,0.029,VW Golf R
+1,44409.6,981.02,107.32,873.7,43535.9,48,0.029,VW Golf R
+2,43535.9,981.02,105.21,875.81,42660.09,48,0.029,VW Golf R
+3,42660.09,981.02,103.09,877.93,41782.16,48,0.029,VW Golf R
+4,41782.16,981.02,100.97,880.05,40902.11,48,0.029,VW Golf R
+5,40902.11,981.02,98.84,882.18,40019.93,48,0.029,VW Golf R
+6,40019.93,981.02,96.71,884.31,39135.62,48,0.029,VW Golf R
+7,39135.62,981.02,94.57,886.45,38249.17,48,0.029,VW Golf R
+8,38249.17,981.02,92.43,888.59,37360.58,48,0.029,VW Golf R
+9,37360.58,981.02,90.28,890.74,36469.84,48,0.029,VW Golf R
+10,36469.84,981.02,88.13,892.89,35576.95,48,0.029,VW Golf R
+11,35576.95,981.02,85.97,895.05,34681.9,48,0.029,VW Golf R
+12,34681.9,981.02,83.81,897.21,33784.69,48,0.029,VW Golf R
+13,33784.69,981.02,81.64,899.38,32885.31,48,0.029,VW Golf R
+14,32885.31,981.02,79.47,901.55,31983.76,48,0.029,VW Golf R
+15,31983.76,981.02,77.29,903.73,31080.03,48,0.029,VW Golf R
+16,31080.03,981.02,75.11,905.91,30174.12,48,0.029,VW Golf R
+17,30174.12,981.02,72.92,908.1,29266.02,48,0.029,VW Golf R
+18,29266.02,981.02,70.72,910.3,28355.72,48,0.029,VW Golf R
+19,28355.72,981.02,68.52,912.5,27443.22,48,0.029,VW Golf R
+20,27443.22,981.02,66.32,914.7,26528.52,48,0.029,VW Golf R
+21,26528.52,981.02,64.11,916.91,25611.61,48,0.029,VW Golf R
+22,25611.61,981.02,61.89,919.13,24692.48,48,0.029,VW Golf R
+23,24692.48,981.02,59.67,921.35,23771.13,48,0.029,VW Golf R
+24,23771.13,981.02,57.44,923.58,22847.55,48,0.029,VW Golf R
+25,22847.55,981.02,55.21,925.81,21921.74,48,0.029,VW Golf R
+26,21921.74,981.02,52.97,928.05,20993.69,48,0.029,VW Golf R
+27,20993.69,981.02,50.73,930.29,20063.4,48,0.029,VW Golf R
+28,20063.4,981.02,48.48,932.54,19130.86,48,0.029,VW Golf R
+29,19130.86,981.02,46.23,934.79,18196.07,48,0.029,VW Golf R
+30,18196.07,981.02,43.97,937.05,17259.02,48,0.029,VW Golf R
+31,17259.02,981.02,41.7,939.32,16319.7,48,0.029,VW Golf R
+32,16319.7,981.02,39.43,941.59,15378.11,48,0.029,VW Golf R
+33,15378.11,981.02,37.16,943.86,14434.25,48,0.029,VW Golf R
+34,14434.25,981.02,34.88,946.14,13488.11,48,0.029,VW Golf R
+35,13488.11,981.02,32.59,948.43,12539.68,48,0.029,VW Golf R
+36,12539.68,981.02,30.3,950.72,11588.96,48,0.029,VW Golf R
+37,11588.96,981.02,28.0,953.02,10635.94,48,0.029,VW Golf R
+38,10635.94,981.02,25.7,955.32,9680.62,48,0.029,VW Golf R
+39,9680.62,981.02,23.39,957.63,8722.99,48,0.029,VW Golf R
+40,8722.99,981.02,21.08,959.94,7763.05,48,0.029,VW Golf R
+41,7763.05,981.02,18.76,962.26,6800.79,48,0.029,VW Golf R
+42,6800.79,981.02,16.43,964.59,5836.2,48,0.029,VW Golf R
+43,5836.2,981.02,14.1,966.92,4869.28,48,0.029,VW Golf R
+44,4869.28,981.02,11.76,969.26,3900.02,48,0.029,VW Golf R
+45,3900.02,981.02,9.42,971.6,2928.42,48,0.029,VW Golf R
+46,2928.42,981.02,7.07,973.95,1954.47,48,0.029,VW Golf R
+47,1954.47,981.02,4.72,976.3,978.17,48,0.029,VW Golf R
+48,978.17,981.02,2.36,978.66,-0.49,48,0.029,VW Golf R
+1,44409.6,796.01,107.32,688.69,43720.91,60,0.029,VW Golf R
+2,43720.91,796.01,105.65,690.36,43030.55,60,0.029,VW Golf R
+3,43030.55,796.01,103.99,692.02,42338.53,60,0.029,VW Golf R
+4,42338.53,796.01,102.31,693.7,41644.83,60,0.029,VW Golf R
+5,41644.83,796.01,100.64,695.37,40949.46,60,0.029,VW Golf R
+6,40949.46,796.01,98.96,697.05,40252.41,60,0.029,VW Golf R
+7,40252.41,796.01,97.27,698.74,39553.67,60,0.029,VW Golf R
+8,39553.67,796.01,95.58,700.43,38853.24,60,0.029,VW Golf R
+9,38853.24,796.01,93.89,702.12,38151.12,60,0.029,VW Golf R
+10,38151.12,796.01,92.19,703.82,37447.3,60,0.029,VW Golf R
+11,37447.3,796.01,90.49,705.52,36741.78,60,0.029,VW Golf R
+12,36741.78,796.01,88.79,707.22,36034.56,60,0.029,VW Golf R
+13,36034.56,796.01,87.08,708.93,35325.63,60,0.029,VW Golf R
+14,35325.63,796.01,85.37,710.64,34614.99,60,0.029,VW Golf R
+15,34614.99,796.01,83.65,712.36,33902.63,60,0.029,VW Golf R
+16,33902.63,796.01,81.93,714.08,33188.55,60,0.029,VW Golf R
+17,33188.55,796.01,80.2,715.81,32472.74,60,0.029,VW Golf R
+18,32472.74,796.01,78.47,717.54,31755.2,60,0.029,VW Golf R
+19,31755.2,796.01,76.74,719.27,31035.93,60,0.029,VW Golf R
+20,31035.93,796.01,75.0,721.01,30314.92,60,0.029,VW Golf R
+21,30314.92,796.01,73.26,722.75,29592.17,60,0.029,VW Golf R
+22,29592.17,796.01,71.51,724.5,28867.67,60,0.029,VW Golf R
+23,28867.67,796.01,69.76,726.25,28141.42,60,0.029,VW Golf R
+24,28141.42,796.01,68.0,728.01,27413.41,60,0.029,VW Golf R
+25,27413.41,796.01,66.24,729.77,26683.64,60,0.029,VW Golf R
+26,26683.64,796.01,64.48,731.53,25952.11,60,0.029,VW Golf R
+27,25952.11,796.01,62.71,733.3,25218.81,60,0.029,VW Golf R
+28,25218.81,796.01,60.94,735.07,24483.74,60,0.029,VW Golf R
+29,24483.74,796.01,59.16,736.85,23746.89,60,0.029,VW Golf R
+30,23746.89,796.01,57.38,738.63,23008.26,60,0.029,VW Golf R
+31,23008.26,796.01,55.6,740.41,22267.85,60,0.029,VW Golf R
+32,22267.85,796.01,53.81,742.2,21525.65,60,0.029,VW Golf R
+33,21525.65,796.01,52.02,743.99,20781.66,60,0.029,VW Golf R
+34,20781.66,796.01,50.22,745.79,20035.87,60,0.029,VW Golf R
+35,20035.87,796.01,48.42,747.59,19288.28,60,0.029,VW Golf R
+36,19288.28,796.01,46.61,749.4,18538.88,60,0.029,VW Golf R
+37,18538.88,796.01,44.8,751.21,17787.67,60,0.029,VW Golf R
+38,17787.67,796.01,42.98,753.03,17034.64,60,0.029,VW Golf R
+39,17034.64,796.01,41.16,754.85,16279.79,60,0.029,VW Golf R
+40,16279.79,796.01,39.34,756.67,15523.12,60,0.029,VW Golf R
+41,15523.12,796.01,37.51,758.5,14764.62,60,0.029,VW Golf R
+42,14764.62,796.01,35.68,760.33,14004.29,60,0.029,VW Golf R
+43,14004.29,796.01,33.84,762.17,13242.12,60,0.029,VW Golf R
+44,13242.12,796.01,32.0,764.01,12478.11,60,0.029,VW Golf R
+45,12478.11,796.01,30.15,765.86,11712.25,60,0.029,VW Golf R
+46,11712.25,796.01,28.3,767.71,10944.54,60,0.029,VW Golf R
+47,10944.54,796.01,26.44,769.57,10174.97,60,0.029,VW Golf R
+48,10174.97,796.01,24.58,771.43,9403.54,60,0.029,VW Golf R
+49,9403.54,796.01,22.72,773.29,8630.25,60,0.029,VW Golf R
+50,8630.25,796.01,20.85,775.16,7855.09,60,0.029,VW Golf R
+51,7855.09,796.01,18.98,777.03,7078.06,60,0.029,VW Golf R
+52,7078.06,796.01,17.1,778.91,6299.15,60,0.029,VW Golf R
+53,6299.15,796.01,15.22,780.79,5518.36,60,0.029,VW Golf R
+54,5518.36,796.01,13.33,782.68,4735.68,60,0.029,VW Golf R
+55,4735.68,796.01,11.44,784.57,3951.11,60,0.029,VW Golf R
+56,3951.11,796.01,9.54,786.47,3164.64,60,0.029,VW Golf R
+57,3164.64,796.01,7.64,788.37,2376.27,60,0.029,VW Golf R
+58,2376.27,796.01,5.74,790.27,1586.0,60,0.029,VW Golf R
+59,1586.0,796.01,3.83,792.18,793.82,60,0.029,VW Golf R
+60,793.82,796.01,1.91,794.1,-0.28,60,0.029,VW Golf R
diff --git a/Pandas/data/car_financing.xlsx b/Pandas/data/car_financing.xlsx
new file mode 100755
index 0000000..99ae9b0
Binary files /dev/null and b/Pandas/data/car_financing.xlsx differ
diff --git a/Pandas/data/table_i702t60.csv b/Pandas/data/table_i702t60.csv
new file mode 100755
index 0000000..a98d007
--- /dev/null
+++ b/Pandas/data/table_i702t60.csv
@@ -0,0 +1,61 @@
+,month,starting_balance,interest_paid,principal_paid,new_balance,interest_rate,car_type
+0,1,34689.96,202.93,484.3,34205.66,0.0702,Toyota Sienna
+1,2,34205.66,200.1,487.13,33718.53,0.0702,Toyota Sienna
+2,3,33718.53,197.25,489.98,33228.55,0.0702,Toyota Sienna
+3,4,33228.55,194.38,492.85,32735.7,0.0702,Toyota Sienna
+4,5,32735.7,191.5,495.73,32239.97,0.0702,Toyota Sienna
+5,6,32239.97,188.6,498.63,31741.34,0.0702,Toyota Sienna
+6,7,31741.34,185.68,501.55,31239.79,0.0702,Toyota Sienna
+7,8,31239.79,182.75,504.48,30735.31,0.0702,Toyota Sienna
+8,9,30735.31,179.8,507.43,30227.88,0.0702,Toyota Sienna
+9,10,30227.88,176.83,510.4,29717.48,0.0702,Toyota Sienna
+10,11,29717.48,173.84,513.39,29204.09,0.0702,Toyota Sienna
+11,12,29204.09,170.84,516.39,28687.7,0.0702,Toyota Sienna
+12,13,28687.7,167.82,519.41,28168.29,0.0702,Toyota Sienna
+13,14,28168.29,164.78,522.45,27645.84,0.0702,Toyota Sienna
+14,15,27645.84,161.72,525.51,27120.33,0.0702,Toyota Sienna
+15,16,27120.33,158.65,528.58,26591.75,0.0702,Toyota Sienna
+16,17,26591.75,155.56,531.67,26060.08,0.0702,Toyota Sienna
+17,18,26060.08,152.45,534.78,25525.3,0.0702,Toyota Sienna
+18,19,25525.3,149.32,537.91,24987.39,0.0702,Toyota Sienna
+19,20,24987.39,146.17,541.06,24446.33,0.0702,Toyota Sienna
+20,21,24446.33,143.01,544.22,23902.11,0.0702,Toyota Sienna
+21,22,23902.11,139.82,547.41,23354.7,0.0702,Toyota Sienna
+22,23,23354.7,136.62,550.61,22804.09,0.0702,Toyota Sienna
+23,24,22804.09,133.4,553.83,22250.26,0.0702,Toyota Sienna
+24,25,22250.26,130.16,557.07,21693.19,0.0702,Toyota Sienna
+25,26,21693.19,126.9,560.33,21132.86,0.0702,Toyota Sienna
+26,27,21132.86,123.62,563.61,20569.25,0.0702,Toyota Sienna
+27,28,20569.25,120.33,566.9,20002.35,0.0702,Toyota Sienna
+28,29,20002.35,117.01,570.22,19432.13,0.0702,Toyota Sienna
+29,30,19432.13,113.67,573.56,18858.57,0.0702,Toyota Sienna
+30,31,18858.57,110.32,576.91,18281.66,0.0702,Toyota Sienna
+31,32,18281.66,106.94,580.29,17701.37,0.0702,Toyota Sienna
+32,33,17701.37,103.55,583.68,17117.69,0.0702,Toyota Sienna
+33,34,17117.69,100.13,587.1,16530.59,0.0702,Toyota Sienna
+34,35,16530.59,96.7,590.53,15940.06,0.0702,Toyota Sienna
+35,36,15940.06,93.24,593.99,15346.07,0.0702,Toyota Sienna
+36,37,15346.07,89.77,597.46,14748.61,0.0702,Toyota Sienna
+37,38,14748.61,86.27,600.96,14147.65,0.0702,Toyota Sienna
+38,39,14147.65,82.76,604.47,13543.18,0.0702,Toyota Sienna
+39,40,13543.18,79.22,608.01,12935.17,0.0702,Toyota Sienna
+40,41,12935.17,75.67,611.56,12323.61,0.0702,Toyota Sienna
+41,42,12323.61,72.09,615.14,11708.47,0.0702,Toyota Sienna
+42,43,11708.47,68.49,618.74,11089.73,0.0702,Toyota Sienna
+43,44,11089.73,64.87,622.36,10467.37,0.0702,Toyota Sienna
+44,45,10467.37,61.23,626.0,9841.37,0.0702,Toyota Sienna
+45,46,9841.37,57.57,629.66,9211.71,0.0702,Toyota Sienna
+46,47,9211.71,53.88,633.35,8578.36,0.0702,Toyota Sienna
+47,48,8578.36,50.18,637.05,7941.31,0.0702,Toyota Sienna
+48,49,7941.31,46.45,640.78,7300.53,0.0702,Toyota Sienna
+49,50,7300.53,42.7,644.53,6656.0,0.0702,Toyota Sienna
+50,51,6656.0,38.93,648.3,6007.7,0.0702,Toyota Sienna
+51,52,6007.7,35.14,652.09,5355.61,0.0702,Toyota Sienna
+52,53,5355.61,31.33,655.9,4699.71,0.0702,Toyota Sienna
+53,54,4699.71,27.49,659.74,4039.97,0.0702,Toyota Sienna
+54,55,4039.97,23.63,663.6,3376.37,0.0702,Toyota Sienna
+55,56,3376.37,19.75,667.48,2708.89,0.0702,Toyota Sienna
+56,57,2708.89,15.84,671.39,2037.5,0.0702,Toyota Sienna
+57,58,2037.5,11.91,675.32,1362.18,0.0702,Toyota Sienna
+58,59,1362.18,7.96,679.27,682.91,0.0702,Toyota Sienna
+59,60,682.91,3.99,683.24,-0.33,0.0702,Toyota Sienna
diff --git a/Pandas/data/table_i702t60.xlsx b/Pandas/data/table_i702t60.xlsx
new file mode 100755
index 0000000..85858b4
Binary files /dev/null and b/Pandas/data/table_i702t60.xlsx differ
diff --git a/Pandas/images/.DS_Store b/Pandas/images/.DS_Store
new file mode 100644
index 0000000..5008ddf
Binary files /dev/null and b/Pandas/images/.DS_Store differ
diff --git a/Pandas/images/pandasDataFrame.png b/Pandas/images/pandasDataFrame.png
new file mode 100755
index 0000000..8ce6b70
Binary files /dev/null and b/Pandas/images/pandasDataFrame.png differ
diff --git a/Pandas/images/principal_interest.png b/Pandas/images/principal_interest.png
new file mode 100755
index 0000000..4505ea1
Binary files /dev/null and b/Pandas/images/principal_interest.png differ