diff --git a/your-code/.ipynb_checkpoints/main-checkpoint.ipynb b/your-code/.ipynb_checkpoints/main-checkpoint.ipynb
new file mode 100644
index 0000000..bc81467
--- /dev/null
+++ b/your-code/.ipynb_checkpoints/main-checkpoint.ipynb
@@ -0,0 +1,1082 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Introduction to Pandas Lab\n",
+ "\n",
+ "Complete the following set of exercises to solidify your knowledge of Pandas fundamentals."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 1. Import Numpy and Pandas and alias them to `np` and `pd` respectively."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import numpy as np\n",
+ "import pandas as pd"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 2. Create a Pandas Series containing the elements of the list below."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "lst = [5.7, 75.2, 74.4, 84.0, 66.5, 66.3, 55.8, 75.7, 29.1, 43.7]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "series1 = pd.Series([5.7, 75.2, 74.4, 84.0, 66.5, 66.3, 55.8, 75.7, 29.1, 43.7])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "0 5.7\n",
+ "1 75.2\n",
+ "2 74.4\n",
+ "3 84.0\n",
+ "4 66.5\n",
+ "5 66.3\n",
+ "6 55.8\n",
+ "7 75.7\n",
+ "8 29.1\n",
+ "9 43.7\n",
+ "dtype: float64"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "display(series1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 3. Use indexing to return the third value in the Series above.\n",
+ "\n",
+ "*Hint: Remember that indexing begins at 0.*"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "74.4"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "series1[2]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 4. Create a Pandas DataFrame from the list of lists below. Each sublist should be represented as a row."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "b = [[53.1, 95.0, 67.5, 35.0, 78.4],\n",
+ " [61.3, 40.8, 30.8, 37.8, 87.6],\n",
+ " [20.6, 73.2, 44.2, 14.6, 91.8],\n",
+ " [57.4, 0.1, 96.1, 4.2, 69.5],\n",
+ " [83.6, 20.5, 85.4, 22.8, 35.9],\n",
+ " [49.0, 69.0, 0.1, 31.8, 89.1],\n",
+ " [23.3, 40.7, 95.0, 83.8, 26.9],\n",
+ " [27.6, 26.4, 53.8, 88.8, 68.5],\n",
+ " [96.6, 96.4, 53.4, 72.4, 50.1],\n",
+ " [73.7, 39.0, 43.2, 81.6, 34.7]]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "new_df = pd.DataFrame([[53.1, 95.0, 67.5, 35.0, 78.4],\n",
+ " [61.3, 40.8, 30.8, 37.8, 87.6],\n",
+ " [20.6, 73.2, 44.2, 14.6, 91.8],\n",
+ " [57.4, 0.1, 96.1, 4.2, 69.5],\n",
+ " [83.6, 20.5, 85.4, 22.8, 35.9],\n",
+ " [49.0, 69.0, 0.1, 31.8, 89.1],\n",
+ " [23.3, 40.7, 95.0, 83.8, 26.9],\n",
+ " [27.6, 26.4, 53.8, 88.8, 68.5],\n",
+ " [96.6, 96.4, 53.4, 72.4, 50.1],\n",
+ " [73.7, 39.0, 43.2, 81.6, 34.7]])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 0 | \n",
+ " 1 | \n",
+ " 2 | \n",
+ " 3 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 53.1 | \n",
+ " 95.0 | \n",
+ " 67.5 | \n",
+ " 35.0 | \n",
+ " 78.4 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 61.3 | \n",
+ " 40.8 | \n",
+ " 30.8 | \n",
+ " 37.8 | \n",
+ " 87.6 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 20.6 | \n",
+ " 73.2 | \n",
+ " 44.2 | \n",
+ " 14.6 | \n",
+ " 91.8 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 57.4 | \n",
+ " 0.1 | \n",
+ " 96.1 | \n",
+ " 4.2 | \n",
+ " 69.5 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 83.6 | \n",
+ " 20.5 | \n",
+ " 85.4 | \n",
+ " 22.8 | \n",
+ " 35.9 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " 49.0 | \n",
+ " 69.0 | \n",
+ " 0.1 | \n",
+ " 31.8 | \n",
+ " 89.1 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " 23.3 | \n",
+ " 40.7 | \n",
+ " 95.0 | \n",
+ " 83.8 | \n",
+ " 26.9 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " 27.6 | \n",
+ " 26.4 | \n",
+ " 53.8 | \n",
+ " 88.8 | \n",
+ " 68.5 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " 96.6 | \n",
+ " 96.4 | \n",
+ " 53.4 | \n",
+ " 72.4 | \n",
+ " 50.1 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " 73.7 | \n",
+ " 39.0 | \n",
+ " 43.2 | \n",
+ " 81.6 | \n",
+ " 34.7 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 0 1 2 3 4\n",
+ "0 53.1 95.0 67.5 35.0 78.4\n",
+ "1 61.3 40.8 30.8 37.8 87.6\n",
+ "2 20.6 73.2 44.2 14.6 91.8\n",
+ "3 57.4 0.1 96.1 4.2 69.5\n",
+ "4 83.6 20.5 85.4 22.8 35.9\n",
+ "5 49.0 69.0 0.1 31.8 89.1\n",
+ "6 23.3 40.7 95.0 83.8 26.9\n",
+ "7 27.6 26.4 53.8 88.8 68.5\n",
+ "8 96.6 96.4 53.4 72.4 50.1\n",
+ "9 73.7 39.0 43.2 81.6 34.7"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "display(new_df)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 5. Rename the data frame columns based on the names in the list below."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "colnames = ['Score_1', 'Score_2', 'Score_3', 'Score_4', 'Score_5']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Score_1 | \n",
+ " Score_2 | \n",
+ " Score_3 | \n",
+ " Score_4 | \n",
+ " Score_5 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 53.1 | \n",
+ " 95.0 | \n",
+ " 67.5 | \n",
+ " 35.0 | \n",
+ " 78.4 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 61.3 | \n",
+ " 40.8 | \n",
+ " 30.8 | \n",
+ " 37.8 | \n",
+ " 87.6 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 20.6 | \n",
+ " 73.2 | \n",
+ " 44.2 | \n",
+ " 14.6 | \n",
+ " 91.8 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 57.4 | \n",
+ " 0.1 | \n",
+ " 96.1 | \n",
+ " 4.2 | \n",
+ " 69.5 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 83.6 | \n",
+ " 20.5 | \n",
+ " 85.4 | \n",
+ " 22.8 | \n",
+ " 35.9 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " 49.0 | \n",
+ " 69.0 | \n",
+ " 0.1 | \n",
+ " 31.8 | \n",
+ " 89.1 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " 23.3 | \n",
+ " 40.7 | \n",
+ " 95.0 | \n",
+ " 83.8 | \n",
+ " 26.9 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " 27.6 | \n",
+ " 26.4 | \n",
+ " 53.8 | \n",
+ " 88.8 | \n",
+ " 68.5 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " 96.6 | \n",
+ " 96.4 | \n",
+ " 53.4 | \n",
+ " 72.4 | \n",
+ " 50.1 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " 73.7 | \n",
+ " 39.0 | \n",
+ " 43.2 | \n",
+ " 81.6 | \n",
+ " 34.7 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Score_1 Score_2 Score_3 Score_4 Score_5\n",
+ "0 53.1 95.0 67.5 35.0 78.4\n",
+ "1 61.3 40.8 30.8 37.8 87.6\n",
+ "2 20.6 73.2 44.2 14.6 91.8\n",
+ "3 57.4 0.1 96.1 4.2 69.5\n",
+ "4 83.6 20.5 85.4 22.8 35.9\n",
+ "5 49.0 69.0 0.1 31.8 89.1\n",
+ "6 23.3 40.7 95.0 83.8 26.9\n",
+ "7 27.6 26.4 53.8 88.8 68.5\n",
+ "8 96.6 96.4 53.4 72.4 50.1\n",
+ "9 73.7 39.0 43.2 81.6 34.7"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "new_df = new_df.rename(columns={0:'Score_1',1:'Score_2',2:'Score_3',3:'Score_4',4:'Score_5'})\n",
+ "new_df"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 6. Create a subset of this data frame that contains only the Score 1, 3, and 5 columns."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Score_1 | \n",
+ " Score_3 | \n",
+ " Score_5 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 53.1 | \n",
+ " 67.5 | \n",
+ " 78.4 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 61.3 | \n",
+ " 30.8 | \n",
+ " 87.6 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 20.6 | \n",
+ " 44.2 | \n",
+ " 91.8 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 57.4 | \n",
+ " 96.1 | \n",
+ " 69.5 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 83.6 | \n",
+ " 85.4 | \n",
+ " 35.9 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Score_1 Score_3 Score_5\n",
+ "0 53.1 67.5 78.4\n",
+ "1 61.3 30.8 87.6\n",
+ "2 20.6 44.2 91.8\n",
+ "3 57.4 96.1 69.5\n",
+ "4 83.6 85.4 35.9"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "sub_df = new_df[['Score_1', 'Score_3', 'Score_5']]\n",
+ "sub_df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 7. From the original data frame, calculate the average Score_3 value."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Score_1 | \n",
+ " Score_2 | \n",
+ " Score_3 | \n",
+ " Score_4 | \n",
+ " Score_5 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | count | \n",
+ " 10.00000 | \n",
+ " 10.00000 | \n",
+ " 10.000000 | \n",
+ " 10.000000 | \n",
+ " 10.000000 | \n",
+ "
\n",
+ " \n",
+ " | mean | \n",
+ " 54.62000 | \n",
+ " 50.11000 | \n",
+ " 56.950000 | \n",
+ " 47.280000 | \n",
+ " 63.250000 | \n",
+ "
\n",
+ " \n",
+ " | std | \n",
+ " 25.64899 | \n",
+ " 32.12204 | \n",
+ " 30.168278 | \n",
+ " 31.393446 | \n",
+ " 24.562313 | \n",
+ "
\n",
+ " \n",
+ " | min | \n",
+ " 20.60000 | \n",
+ " 0.10000 | \n",
+ " 0.100000 | \n",
+ " 4.200000 | \n",
+ " 26.900000 | \n",
+ "
\n",
+ " \n",
+ " | 25% | \n",
+ " 32.95000 | \n",
+ " 29.55000 | \n",
+ " 43.450000 | \n",
+ " 25.050000 | \n",
+ " 39.450000 | \n",
+ "
\n",
+ " \n",
+ " | 50% | \n",
+ " 55.25000 | \n",
+ " 40.75000 | \n",
+ " 53.600000 | \n",
+ " 36.400000 | \n",
+ " 69.000000 | \n",
+ "
\n",
+ " \n",
+ " | 75% | \n",
+ " 70.60000 | \n",
+ " 72.15000 | \n",
+ " 80.925000 | \n",
+ " 79.300000 | \n",
+ " 85.300000 | \n",
+ "
\n",
+ " \n",
+ " | max | \n",
+ " 96.60000 | \n",
+ " 96.40000 | \n",
+ " 96.100000 | \n",
+ " 88.800000 | \n",
+ " 91.800000 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Score_1 Score_2 Score_3 Score_4 Score_5\n",
+ "count 10.00000 10.00000 10.000000 10.000000 10.000000\n",
+ "mean 54.62000 50.11000 56.950000 47.280000 63.250000\n",
+ "std 25.64899 32.12204 30.168278 31.393446 24.562313\n",
+ "min 20.60000 0.10000 0.100000 4.200000 26.900000\n",
+ "25% 32.95000 29.55000 43.450000 25.050000 39.450000\n",
+ "50% 55.25000 40.75000 53.600000 36.400000 69.000000\n",
+ "75% 70.60000 72.15000 80.925000 79.300000 85.300000\n",
+ "max 96.60000 96.40000 96.100000 88.800000 91.800000"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "new_df.describe()\n",
+ "# Describe method gives the mean of every column, otherwise the calculation is made in the following cell"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "56.95000000000001"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "score_3_average = new_df['Score_3'].sum()/new_df['Score_3'].count()\n",
+ "score_3_average"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 8. From the original data frame, calculate the maximum Score_4 value."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "88.8"
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "#Is also in the .describe method but can be found individually with the .max method\n",
+ "new_df['Score_4'].max()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 9. From the original data frame, calculate the median Score 2 value."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[0.1, 20.5, 26.4, 39.0, 40.7, 40.8, 69.0, 73.2, 95.0, 96.4]"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "m = list(new_df['Score_2'])\n",
+ "m.sort()\n",
+ "m"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "40.75"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "new_df['Score_2'].median()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 10. Create a Pandas DataFrame from the dictionary of product orders below."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "orders = {'Description': ['LUNCH BAG APPLE DESIGN',\n",
+ " 'SET OF 60 VINTAGE LEAF CAKE CASES ',\n",
+ " 'RIBBON REEL STRIPES DESIGN ',\n",
+ " 'WORLD WAR 2 GLIDERS ASSTD DESIGNS',\n",
+ " 'PLAYING CARDS JUBILEE UNION JACK',\n",
+ " 'POPCORN HOLDER',\n",
+ " 'BOX OF VINTAGE ALPHABET BLOCKS',\n",
+ " 'PARTY BUNTING',\n",
+ " 'JAZZ HEARTS ADDRESS BOOK',\n",
+ " 'SET OF 4 SANTA PLACE SETTINGS'],\n",
+ " 'Quantity': [1, 24, 1, 2880, 2, 7, 1, 4, 10, 48],\n",
+ " 'UnitPrice': [1.65, 0.55, 1.65, 0.18, 1.25, 0.85, 11.95, 4.95, 0.19, 1.25],\n",
+ " 'Revenue': [1.65, 13.2, 1.65, 518.4, 2.5, 5.95, 11.95, 19.8, 1.9, 60.0]}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "orders_df = pd.DataFrame(orders)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Description | \n",
+ " Quantity | \n",
+ " UnitPrice | \n",
+ " Revenue | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " LUNCH BAG APPLE DESIGN | \n",
+ " 1 | \n",
+ " 1.65 | \n",
+ " 1.65 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " SET OF 60 VINTAGE LEAF CAKE CASES | \n",
+ " 24 | \n",
+ " 0.55 | \n",
+ " 13.20 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " RIBBON REEL STRIPES DESIGN | \n",
+ " 1 | \n",
+ " 1.65 | \n",
+ " 1.65 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " WORLD WAR 2 GLIDERS ASSTD DESIGNS | \n",
+ " 2880 | \n",
+ " 0.18 | \n",
+ " 518.40 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " PLAYING CARDS JUBILEE UNION JACK | \n",
+ " 2 | \n",
+ " 1.25 | \n",
+ " 2.50 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " POPCORN HOLDER | \n",
+ " 7 | \n",
+ " 0.85 | \n",
+ " 5.95 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " BOX OF VINTAGE ALPHABET BLOCKS | \n",
+ " 1 | \n",
+ " 11.95 | \n",
+ " 11.95 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " PARTY BUNTING | \n",
+ " 4 | \n",
+ " 4.95 | \n",
+ " 19.80 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " JAZZ HEARTS ADDRESS BOOK | \n",
+ " 10 | \n",
+ " 0.19 | \n",
+ " 1.90 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " SET OF 4 SANTA PLACE SETTINGS | \n",
+ " 48 | \n",
+ " 1.25 | \n",
+ " 60.00 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Description Quantity UnitPrice Revenue\n",
+ "0 LUNCH BAG APPLE DESIGN 1 1.65 1.65\n",
+ "1 SET OF 60 VINTAGE LEAF CAKE CASES 24 0.55 13.20\n",
+ "2 RIBBON REEL STRIPES DESIGN 1 1.65 1.65\n",
+ "3 WORLD WAR 2 GLIDERS ASSTD DESIGNS 2880 0.18 518.40\n",
+ "4 PLAYING CARDS JUBILEE UNION JACK 2 1.25 2.50\n",
+ "5 POPCORN HOLDER 7 0.85 5.95\n",
+ "6 BOX OF VINTAGE ALPHABET BLOCKS 1 11.95 11.95\n",
+ "7 PARTY BUNTING 4 4.95 19.80\n",
+ "8 JAZZ HEARTS ADDRESS BOOK 10 0.19 1.90\n",
+ "9 SET OF 4 SANTA PLACE SETTINGS 48 1.25 60.00"
+ ]
+ },
+ "execution_count": 19,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "orders_df"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 11. Calculate the total quantity ordered and revenue generated from these orders."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "2978"
+ ]
+ },
+ "execution_count": 20,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "orders_df['Quantity'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "637.0"
+ ]
+ },
+ "execution_count": 21,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "orders_df['Revenue'].sum()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 12. Obtain the prices of the most expensive and least expensive items ordered and print the difference."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "11.95"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "orders_df['UnitPrice'].max()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "0.18"
+ ]
+ },
+ "execution_count": 23,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "orders_df['UnitPrice'].min()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "11.77"
+ ]
+ },
+ "execution_count": 24,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "difference = orders_df['UnitPrice'].max() - orders_df['UnitPrice'].min()\n",
+ "difference"
+ ]
+ }
+ ],
+ "metadata": {
+ "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.11.5"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/your-code/main.ipynb b/your-code/main.ipynb
index 8a76302..bc81467 100644
--- a/your-code/main.ipynb
+++ b/your-code/main.ipynb
@@ -1,261 +1,1082 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Introduction to Pandas Lab\n",
- "\n",
- "Complete the following set of exercises to solidify your knowledge of Pandas fundamentals."
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 1. Import Numpy and Pandas and alias them to `np` and `pd` respectively."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 2. Create a Pandas Series containing the elements of the list below."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "lst = [5.7, 75.2, 74.4, 84.0, 66.5, 66.3, 55.8, 75.7, 29.1, 43.7]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 3. Use indexing to return the third value in the Series above.\n",
- "\n",
- "*Hint: Remember that indexing begins at 0.*"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 4. Create a Pandas DataFrame from the list of lists below. Each sublist should be represented as a row."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "b = [[53.1, 95.0, 67.5, 35.0, 78.4],\n",
- " [61.3, 40.8, 30.8, 37.8, 87.6],\n",
- " [20.6, 73.2, 44.2, 14.6, 91.8],\n",
- " [57.4, 0.1, 96.1, 4.2, 69.5],\n",
- " [83.6, 20.5, 85.4, 22.8, 35.9],\n",
- " [49.0, 69.0, 0.1, 31.8, 89.1],\n",
- " [23.3, 40.7, 95.0, 83.8, 26.9],\n",
- " [27.6, 26.4, 53.8, 88.8, 68.5],\n",
- " [96.6, 96.4, 53.4, 72.4, 50.1],\n",
- " [73.7, 39.0, 43.2, 81.6, 34.7]]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 5. Rename the data frame columns based on the names in the list below."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "colnames = ['Score_1', 'Score_2', 'Score_3', 'Score_4', 'Score_5']"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 6. Create a subset of this data frame that contains only the Score 1, 3, and 5 columns."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 7. From the original data frame, calculate the average Score_3 value."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 8. From the original data frame, calculate the maximum Score_4 value."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 9. From the original data frame, calculate the median Score 2 value."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 10. Create a Pandas DataFrame from the dictionary of product orders below."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "orders = {'Description': ['LUNCH BAG APPLE DESIGN',\n",
- " 'SET OF 60 VINTAGE LEAF CAKE CASES ',\n",
- " 'RIBBON REEL STRIPES DESIGN ',\n",
- " 'WORLD WAR 2 GLIDERS ASSTD DESIGNS',\n",
- " 'PLAYING CARDS JUBILEE UNION JACK',\n",
- " 'POPCORN HOLDER',\n",
- " 'BOX OF VINTAGE ALPHABET BLOCKS',\n",
- " 'PARTY BUNTING',\n",
- " 'JAZZ HEARTS ADDRESS BOOK',\n",
- " 'SET OF 4 SANTA PLACE SETTINGS'],\n",
- " 'Quantity': [1, 24, 1, 2880, 2, 7, 1, 4, 10, 48],\n",
- " 'UnitPrice': [1.65, 0.55, 1.65, 0.18, 1.25, 0.85, 11.95, 4.95, 0.19, 1.25],\n",
- " 'Revenue': [1.65, 13.2, 1.65, 518.4, 2.5, 5.95, 11.95, 19.8, 1.9, 60.0]}"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 11. Calculate the total quantity ordered and revenue generated from these orders."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### 12. Obtain the prices of the most expensive and least expensive items ordered and print the difference."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.6.8"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Introduction to Pandas Lab\n",
+ "\n",
+ "Complete the following set of exercises to solidify your knowledge of Pandas fundamentals."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 1. Import Numpy and Pandas and alias them to `np` and `pd` respectively."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import numpy as np\n",
+ "import pandas as pd"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 2. Create a Pandas Series containing the elements of the list below."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "lst = [5.7, 75.2, 74.4, 84.0, 66.5, 66.3, 55.8, 75.7, 29.1, 43.7]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "series1 = pd.Series([5.7, 75.2, 74.4, 84.0, 66.5, 66.3, 55.8, 75.7, 29.1, 43.7])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "0 5.7\n",
+ "1 75.2\n",
+ "2 74.4\n",
+ "3 84.0\n",
+ "4 66.5\n",
+ "5 66.3\n",
+ "6 55.8\n",
+ "7 75.7\n",
+ "8 29.1\n",
+ "9 43.7\n",
+ "dtype: float64"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "display(series1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 3. Use indexing to return the third value in the Series above.\n",
+ "\n",
+ "*Hint: Remember that indexing begins at 0.*"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "74.4"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "series1[2]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 4. Create a Pandas DataFrame from the list of lists below. Each sublist should be represented as a row."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "b = [[53.1, 95.0, 67.5, 35.0, 78.4],\n",
+ " [61.3, 40.8, 30.8, 37.8, 87.6],\n",
+ " [20.6, 73.2, 44.2, 14.6, 91.8],\n",
+ " [57.4, 0.1, 96.1, 4.2, 69.5],\n",
+ " [83.6, 20.5, 85.4, 22.8, 35.9],\n",
+ " [49.0, 69.0, 0.1, 31.8, 89.1],\n",
+ " [23.3, 40.7, 95.0, 83.8, 26.9],\n",
+ " [27.6, 26.4, 53.8, 88.8, 68.5],\n",
+ " [96.6, 96.4, 53.4, 72.4, 50.1],\n",
+ " [73.7, 39.0, 43.2, 81.6, 34.7]]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "new_df = pd.DataFrame([[53.1, 95.0, 67.5, 35.0, 78.4],\n",
+ " [61.3, 40.8, 30.8, 37.8, 87.6],\n",
+ " [20.6, 73.2, 44.2, 14.6, 91.8],\n",
+ " [57.4, 0.1, 96.1, 4.2, 69.5],\n",
+ " [83.6, 20.5, 85.4, 22.8, 35.9],\n",
+ " [49.0, 69.0, 0.1, 31.8, 89.1],\n",
+ " [23.3, 40.7, 95.0, 83.8, 26.9],\n",
+ " [27.6, 26.4, 53.8, 88.8, 68.5],\n",
+ " [96.6, 96.4, 53.4, 72.4, 50.1],\n",
+ " [73.7, 39.0, 43.2, 81.6, 34.7]])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 0 | \n",
+ " 1 | \n",
+ " 2 | \n",
+ " 3 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 53.1 | \n",
+ " 95.0 | \n",
+ " 67.5 | \n",
+ " 35.0 | \n",
+ " 78.4 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 61.3 | \n",
+ " 40.8 | \n",
+ " 30.8 | \n",
+ " 37.8 | \n",
+ " 87.6 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 20.6 | \n",
+ " 73.2 | \n",
+ " 44.2 | \n",
+ " 14.6 | \n",
+ " 91.8 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 57.4 | \n",
+ " 0.1 | \n",
+ " 96.1 | \n",
+ " 4.2 | \n",
+ " 69.5 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 83.6 | \n",
+ " 20.5 | \n",
+ " 85.4 | \n",
+ " 22.8 | \n",
+ " 35.9 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " 49.0 | \n",
+ " 69.0 | \n",
+ " 0.1 | \n",
+ " 31.8 | \n",
+ " 89.1 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " 23.3 | \n",
+ " 40.7 | \n",
+ " 95.0 | \n",
+ " 83.8 | \n",
+ " 26.9 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " 27.6 | \n",
+ " 26.4 | \n",
+ " 53.8 | \n",
+ " 88.8 | \n",
+ " 68.5 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " 96.6 | \n",
+ " 96.4 | \n",
+ " 53.4 | \n",
+ " 72.4 | \n",
+ " 50.1 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " 73.7 | \n",
+ " 39.0 | \n",
+ " 43.2 | \n",
+ " 81.6 | \n",
+ " 34.7 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 0 1 2 3 4\n",
+ "0 53.1 95.0 67.5 35.0 78.4\n",
+ "1 61.3 40.8 30.8 37.8 87.6\n",
+ "2 20.6 73.2 44.2 14.6 91.8\n",
+ "3 57.4 0.1 96.1 4.2 69.5\n",
+ "4 83.6 20.5 85.4 22.8 35.9\n",
+ "5 49.0 69.0 0.1 31.8 89.1\n",
+ "6 23.3 40.7 95.0 83.8 26.9\n",
+ "7 27.6 26.4 53.8 88.8 68.5\n",
+ "8 96.6 96.4 53.4 72.4 50.1\n",
+ "9 73.7 39.0 43.2 81.6 34.7"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "display(new_df)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 5. Rename the data frame columns based on the names in the list below."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "colnames = ['Score_1', 'Score_2', 'Score_3', 'Score_4', 'Score_5']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Score_1 | \n",
+ " Score_2 | \n",
+ " Score_3 | \n",
+ " Score_4 | \n",
+ " Score_5 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 53.1 | \n",
+ " 95.0 | \n",
+ " 67.5 | \n",
+ " 35.0 | \n",
+ " 78.4 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 61.3 | \n",
+ " 40.8 | \n",
+ " 30.8 | \n",
+ " 37.8 | \n",
+ " 87.6 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 20.6 | \n",
+ " 73.2 | \n",
+ " 44.2 | \n",
+ " 14.6 | \n",
+ " 91.8 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 57.4 | \n",
+ " 0.1 | \n",
+ " 96.1 | \n",
+ " 4.2 | \n",
+ " 69.5 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 83.6 | \n",
+ " 20.5 | \n",
+ " 85.4 | \n",
+ " 22.8 | \n",
+ " 35.9 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " 49.0 | \n",
+ " 69.0 | \n",
+ " 0.1 | \n",
+ " 31.8 | \n",
+ " 89.1 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " 23.3 | \n",
+ " 40.7 | \n",
+ " 95.0 | \n",
+ " 83.8 | \n",
+ " 26.9 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " 27.6 | \n",
+ " 26.4 | \n",
+ " 53.8 | \n",
+ " 88.8 | \n",
+ " 68.5 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " 96.6 | \n",
+ " 96.4 | \n",
+ " 53.4 | \n",
+ " 72.4 | \n",
+ " 50.1 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " 73.7 | \n",
+ " 39.0 | \n",
+ " 43.2 | \n",
+ " 81.6 | \n",
+ " 34.7 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Score_1 Score_2 Score_3 Score_4 Score_5\n",
+ "0 53.1 95.0 67.5 35.0 78.4\n",
+ "1 61.3 40.8 30.8 37.8 87.6\n",
+ "2 20.6 73.2 44.2 14.6 91.8\n",
+ "3 57.4 0.1 96.1 4.2 69.5\n",
+ "4 83.6 20.5 85.4 22.8 35.9\n",
+ "5 49.0 69.0 0.1 31.8 89.1\n",
+ "6 23.3 40.7 95.0 83.8 26.9\n",
+ "7 27.6 26.4 53.8 88.8 68.5\n",
+ "8 96.6 96.4 53.4 72.4 50.1\n",
+ "9 73.7 39.0 43.2 81.6 34.7"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "new_df = new_df.rename(columns={0:'Score_1',1:'Score_2',2:'Score_3',3:'Score_4',4:'Score_5'})\n",
+ "new_df"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 6. Create a subset of this data frame that contains only the Score 1, 3, and 5 columns."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Score_1 | \n",
+ " Score_3 | \n",
+ " Score_5 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 53.1 | \n",
+ " 67.5 | \n",
+ " 78.4 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 61.3 | \n",
+ " 30.8 | \n",
+ " 87.6 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 20.6 | \n",
+ " 44.2 | \n",
+ " 91.8 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 57.4 | \n",
+ " 96.1 | \n",
+ " 69.5 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 83.6 | \n",
+ " 85.4 | \n",
+ " 35.9 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Score_1 Score_3 Score_5\n",
+ "0 53.1 67.5 78.4\n",
+ "1 61.3 30.8 87.6\n",
+ "2 20.6 44.2 91.8\n",
+ "3 57.4 96.1 69.5\n",
+ "4 83.6 85.4 35.9"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "sub_df = new_df[['Score_1', 'Score_3', 'Score_5']]\n",
+ "sub_df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 7. From the original data frame, calculate the average Score_3 value."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Score_1 | \n",
+ " Score_2 | \n",
+ " Score_3 | \n",
+ " Score_4 | \n",
+ " Score_5 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | count | \n",
+ " 10.00000 | \n",
+ " 10.00000 | \n",
+ " 10.000000 | \n",
+ " 10.000000 | \n",
+ " 10.000000 | \n",
+ "
\n",
+ " \n",
+ " | mean | \n",
+ " 54.62000 | \n",
+ " 50.11000 | \n",
+ " 56.950000 | \n",
+ " 47.280000 | \n",
+ " 63.250000 | \n",
+ "
\n",
+ " \n",
+ " | std | \n",
+ " 25.64899 | \n",
+ " 32.12204 | \n",
+ " 30.168278 | \n",
+ " 31.393446 | \n",
+ " 24.562313 | \n",
+ "
\n",
+ " \n",
+ " | min | \n",
+ " 20.60000 | \n",
+ " 0.10000 | \n",
+ " 0.100000 | \n",
+ " 4.200000 | \n",
+ " 26.900000 | \n",
+ "
\n",
+ " \n",
+ " | 25% | \n",
+ " 32.95000 | \n",
+ " 29.55000 | \n",
+ " 43.450000 | \n",
+ " 25.050000 | \n",
+ " 39.450000 | \n",
+ "
\n",
+ " \n",
+ " | 50% | \n",
+ " 55.25000 | \n",
+ " 40.75000 | \n",
+ " 53.600000 | \n",
+ " 36.400000 | \n",
+ " 69.000000 | \n",
+ "
\n",
+ " \n",
+ " | 75% | \n",
+ " 70.60000 | \n",
+ " 72.15000 | \n",
+ " 80.925000 | \n",
+ " 79.300000 | \n",
+ " 85.300000 | \n",
+ "
\n",
+ " \n",
+ " | max | \n",
+ " 96.60000 | \n",
+ " 96.40000 | \n",
+ " 96.100000 | \n",
+ " 88.800000 | \n",
+ " 91.800000 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Score_1 Score_2 Score_3 Score_4 Score_5\n",
+ "count 10.00000 10.00000 10.000000 10.000000 10.000000\n",
+ "mean 54.62000 50.11000 56.950000 47.280000 63.250000\n",
+ "std 25.64899 32.12204 30.168278 31.393446 24.562313\n",
+ "min 20.60000 0.10000 0.100000 4.200000 26.900000\n",
+ "25% 32.95000 29.55000 43.450000 25.050000 39.450000\n",
+ "50% 55.25000 40.75000 53.600000 36.400000 69.000000\n",
+ "75% 70.60000 72.15000 80.925000 79.300000 85.300000\n",
+ "max 96.60000 96.40000 96.100000 88.800000 91.800000"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "new_df.describe()\n",
+ "# Describe method gives the mean of every column, otherwise the calculation is made in the following cell"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "56.95000000000001"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "score_3_average = new_df['Score_3'].sum()/new_df['Score_3'].count()\n",
+ "score_3_average"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 8. From the original data frame, calculate the maximum Score_4 value."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "88.8"
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "#Is also in the .describe method but can be found individually with the .max method\n",
+ "new_df['Score_4'].max()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 9. From the original data frame, calculate the median Score 2 value."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[0.1, 20.5, 26.4, 39.0, 40.7, 40.8, 69.0, 73.2, 95.0, 96.4]"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "m = list(new_df['Score_2'])\n",
+ "m.sort()\n",
+ "m"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "40.75"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "new_df['Score_2'].median()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 10. Create a Pandas DataFrame from the dictionary of product orders below."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "orders = {'Description': ['LUNCH BAG APPLE DESIGN',\n",
+ " 'SET OF 60 VINTAGE LEAF CAKE CASES ',\n",
+ " 'RIBBON REEL STRIPES DESIGN ',\n",
+ " 'WORLD WAR 2 GLIDERS ASSTD DESIGNS',\n",
+ " 'PLAYING CARDS JUBILEE UNION JACK',\n",
+ " 'POPCORN HOLDER',\n",
+ " 'BOX OF VINTAGE ALPHABET BLOCKS',\n",
+ " 'PARTY BUNTING',\n",
+ " 'JAZZ HEARTS ADDRESS BOOK',\n",
+ " 'SET OF 4 SANTA PLACE SETTINGS'],\n",
+ " 'Quantity': [1, 24, 1, 2880, 2, 7, 1, 4, 10, 48],\n",
+ " 'UnitPrice': [1.65, 0.55, 1.65, 0.18, 1.25, 0.85, 11.95, 4.95, 0.19, 1.25],\n",
+ " 'Revenue': [1.65, 13.2, 1.65, 518.4, 2.5, 5.95, 11.95, 19.8, 1.9, 60.0]}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "orders_df = pd.DataFrame(orders)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Description | \n",
+ " Quantity | \n",
+ " UnitPrice | \n",
+ " Revenue | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " LUNCH BAG APPLE DESIGN | \n",
+ " 1 | \n",
+ " 1.65 | \n",
+ " 1.65 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " SET OF 60 VINTAGE LEAF CAKE CASES | \n",
+ " 24 | \n",
+ " 0.55 | \n",
+ " 13.20 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " RIBBON REEL STRIPES DESIGN | \n",
+ " 1 | \n",
+ " 1.65 | \n",
+ " 1.65 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " WORLD WAR 2 GLIDERS ASSTD DESIGNS | \n",
+ " 2880 | \n",
+ " 0.18 | \n",
+ " 518.40 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " PLAYING CARDS JUBILEE UNION JACK | \n",
+ " 2 | \n",
+ " 1.25 | \n",
+ " 2.50 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " POPCORN HOLDER | \n",
+ " 7 | \n",
+ " 0.85 | \n",
+ " 5.95 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " BOX OF VINTAGE ALPHABET BLOCKS | \n",
+ " 1 | \n",
+ " 11.95 | \n",
+ " 11.95 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " PARTY BUNTING | \n",
+ " 4 | \n",
+ " 4.95 | \n",
+ " 19.80 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " JAZZ HEARTS ADDRESS BOOK | \n",
+ " 10 | \n",
+ " 0.19 | \n",
+ " 1.90 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " SET OF 4 SANTA PLACE SETTINGS | \n",
+ " 48 | \n",
+ " 1.25 | \n",
+ " 60.00 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Description Quantity UnitPrice Revenue\n",
+ "0 LUNCH BAG APPLE DESIGN 1 1.65 1.65\n",
+ "1 SET OF 60 VINTAGE LEAF CAKE CASES 24 0.55 13.20\n",
+ "2 RIBBON REEL STRIPES DESIGN 1 1.65 1.65\n",
+ "3 WORLD WAR 2 GLIDERS ASSTD DESIGNS 2880 0.18 518.40\n",
+ "4 PLAYING CARDS JUBILEE UNION JACK 2 1.25 2.50\n",
+ "5 POPCORN HOLDER 7 0.85 5.95\n",
+ "6 BOX OF VINTAGE ALPHABET BLOCKS 1 11.95 11.95\n",
+ "7 PARTY BUNTING 4 4.95 19.80\n",
+ "8 JAZZ HEARTS ADDRESS BOOK 10 0.19 1.90\n",
+ "9 SET OF 4 SANTA PLACE SETTINGS 48 1.25 60.00"
+ ]
+ },
+ "execution_count": 19,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "orders_df"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 11. Calculate the total quantity ordered and revenue generated from these orders."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "2978"
+ ]
+ },
+ "execution_count": 20,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "orders_df['Quantity'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "637.0"
+ ]
+ },
+ "execution_count": 21,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "orders_df['Revenue'].sum()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 12. Obtain the prices of the most expensive and least expensive items ordered and print the difference."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "11.95"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "orders_df['UnitPrice'].max()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "0.18"
+ ]
+ },
+ "execution_count": 23,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "orders_df['UnitPrice'].min()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "11.77"
+ ]
+ },
+ "execution_count": 24,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "difference = orders_df['UnitPrice'].max() - orders_df['UnitPrice'].min()\n",
+ "difference"
+ ]
+ }
+ ],
+ "metadata": {
+ "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.11.5"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}