diff --git a/Akpa Juliet Chisom Numpy and pandas WTF2.ipynb b/Akpa Juliet Chisom Numpy and pandas WTF2.ipynb
new file mode 100644
index 0000000..58901ae
--- /dev/null
+++ b/Akpa Juliet Chisom Numpy and pandas WTF2.ipynb
@@ -0,0 +1,2865 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 89,
+ "id": "07eeac9c",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ba2cc087",
+ "metadata": {},
+ "source": [
+ "### 1. Creating an array"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 90,
+ "id": "ad7506ca",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[1 2 3 4]\n"
+ ]
+ }
+ ],
+ "source": [
+ "a = np.array ([1,2,3,4])\n",
+ "print(a)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 91,
+ "id": "52f529e8",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[[3 4 5]\n",
+ " [6 7 8]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "b = np.array([[3,4,5,],[6,7,8]])\n",
+ "print(b)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "4152ea79",
+ "metadata": {},
+ "source": [
+ "### 2. Getting the dimensions of the array"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 92,
+ "id": "5b906004",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "1"
+ ]
+ },
+ "execution_count": 92,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.ndim"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 93,
+ "id": "28122488",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "2"
+ ]
+ },
+ "execution_count": 93,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "b.ndim"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8550b82d",
+ "metadata": {},
+ "source": [
+ "### 3. Get shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 94,
+ "id": "a46f0a04",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(4,)"
+ ]
+ },
+ "execution_count": 94,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 95,
+ "id": "cf9a0c4f",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(2, 3)"
+ ]
+ },
+ "execution_count": 95,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "b.shape"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "baef9bed",
+ "metadata": {},
+ "source": [
+ "### 4. Getting type\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 97,
+ "id": "daca98a8",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "dtype('int32')"
+ ]
+ },
+ "execution_count": 97,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.dtype"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 98,
+ "id": "a2a53683",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "dtype('int32')"
+ ]
+ },
+ "execution_count": 98,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "b.dtype"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d2b88a95",
+ "metadata": {},
+ "source": [
+ "### 5.Get size\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 99,
+ "id": "84c24713",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "4"
+ ]
+ },
+ "execution_count": 99,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.itemsize"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7146dbfa",
+ "metadata": {},
+ "source": [
+ "### 6. Get total size\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 119,
+ "id": "06e85f57",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "16"
+ ]
+ },
+ "execution_count": 119,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.size*a.itemsize "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 120,
+ "id": "cfc2b78f",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "24"
+ ]
+ },
+ "execution_count": 120,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "b.size*b.itemsize"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 121,
+ "id": "35d833c9",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "16"
+ ]
+ },
+ "execution_count": 121,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# OR\n",
+ "a.nbytes"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 122,
+ "id": "41b9b220",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "24"
+ ]
+ },
+ "execution_count": 122,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "\n",
+ "b.nbytes"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "177e9baf",
+ "metadata": {},
+ "source": [
+ "### 7. arrange: Return evenly spaced values within a given interval."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 154,
+ "id": "472180af",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,\n",
+ " 17, 18, 19])"
+ ]
+ },
+ "execution_count": 154,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.arange(0,20)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7fab781e",
+ "metadata": {},
+ "source": [
+ "### 8. All 1s matrix\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 126,
+ "id": "9814154e",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[1., 1., 1.],\n",
+ " [1., 1., 1.]])"
+ ]
+ },
+ "execution_count": 126,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.ones((2,3))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ce6cf75f",
+ "metadata": {},
+ "source": [
+ "### 9. Random Decimal number\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 127,
+ "id": "041ec266",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[0.79844965, 0.46638252],\n",
+ " [0.10030767, 0.7624191 ],\n",
+ " [0.89164678, 0.23442672],\n",
+ " [0.46971368, 0.52419522]])"
+ ]
+ },
+ "execution_count": 127,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.random.rand(4,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7f8cbf3f",
+ "metadata": {},
+ "source": [
+ "### 10. Random integer values\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 128,
+ "id": "3b2abe96",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[ 3, -3],\n",
+ " [-3, 1]])"
+ ]
+ },
+ "execution_count": 128,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.random.randint(-3,5, size=(2,2))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "2c6e1ae4",
+ "metadata": {},
+ "source": [
+ "### 11. The identity matrix\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 129,
+ "id": "4ce176f6",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[1., 0., 0., 0.],\n",
+ " [0., 1., 0., 0.],\n",
+ " [0., 0., 1., 0.],\n",
+ " [0., 0., 0., 1.]])"
+ ]
+ },
+ "execution_count": 129,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.identity(4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "19ecd6e7",
+ "metadata": {},
+ "source": [
+ "### 12. Repeating array\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 130,
+ "id": "06b69013",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[[1 2 4]\n",
+ " [1 2 4]\n",
+ " [1 2 4]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "arr = np.array([[1,2,4]])\n",
+ "A1 = np.repeat(arr,3, axis = 0)\n",
+ "print(A1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5323f81d",
+ "metadata": {},
+ "source": [
+ "### 13. Copying arrays\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 131,
+ "id": "922f2c9a",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([1, 2, 3])"
+ ]
+ },
+ "execution_count": 131,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a = np.array([1,2,3])\n",
+ "b = a\n",
+ "b"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0836c599",
+ "metadata": {},
+ "source": [
+ "### 14. Getting the maximum value"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 132,
+ "id": "9e3b207a",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Largest value\n",
+ "3\n"
+ ]
+ }
+ ],
+ "source": [
+ "n = a.max()\n",
+ "print(\"Largest value\")\n",
+ "print(n)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0748c9c1",
+ "metadata": {},
+ "source": [
+ "### 15. Getting the minimum value"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 139,
+ "id": "f0edcb51",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "smallest value\n",
+ "1\n"
+ ]
+ }
+ ],
+ "source": [
+ "n = a.min()\n",
+ "print(\"smallest value\")\n",
+ "print(n)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c50ef487",
+ "metadata": {},
+ "source": [
+ "### 16. Appending arrays"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 140,
+ "id": "b4352a22",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Original array\n",
+ "[0 1 2 3 4 5 6 7]\n",
+ "\n",
+ "\n",
+ "Array with appended values at the end\n",
+ "[ 0 1 2 3 4 5 6 7 8 9 10]\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(\"Original array\")\n",
+ "numbers = np.arange(8)\n",
+ "print(numbers)\n",
+ "print(\"\\n\")\n",
+ "print(\"Array with appended values at the end\")\n",
+ "print(np.append(numbers, (8,9,10)))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 141,
+ "id": "ed27bd7d",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Original array\n",
+ "[[ 2 3 4]\n",
+ " [ 5 6 7]\n",
+ " [ 8 9 10]]\n",
+ "\n",
+ "\n",
+ "Arrays with appended values at the end\n",
+ "[[ 2 3 4]\n",
+ " [ 5 6 7]\n",
+ " [ 8 9 10]\n",
+ " [12 13 14]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(\"Original array\")\n",
+ "q = np.arange(2,11).reshape (3,3)\n",
+ "print(q)\n",
+ "print(\"\\n\")\n",
+ "print(\"Arrays with appended values at the end\")\n",
+ "print(np.append(q, [[12,13,14]], axis = 0))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c2a3d5dc",
+ "metadata": {},
+ "source": [
+ "### 17. Printing all boarders 1s and 0s inside"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 142,
+ "id": "12d02b9f",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Original array\n",
+ "[[1. 1. 1. 1. 1. 1.]\n",
+ " [1. 1. 1. 1. 1. 1.]\n",
+ " [1. 1. 1. 1. 1. 1.]\n",
+ " [1. 1. 1. 1. 1. 1.]\n",
+ " [1. 1. 1. 1. 1. 1.]\n",
+ " [1. 1. 1. 1. 1. 1.]]\n",
+ "\n",
+ "\n",
+ "Arrays with one on the boarder and zeros inside\n",
+ "[[1. 1. 1. 1. 1. 1.]\n",
+ " [1. 0. 0. 0. 0. 1.]\n",
+ " [1. 0. 0. 0. 0. 1.]\n",
+ " [1. 0. 0. 0. 0. 1.]\n",
+ " [1. 0. 0. 0. 0. 1.]\n",
+ " [1. 1. 1. 1. 1. 1.]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(\"Original array\")\n",
+ "array_2d = np.ones((6,6))\n",
+ "print(array_2d)\n",
+ "print(\"\\n\")\n",
+ "print(\"Arrays with one on the boarder and zeros inside\")\n",
+ "array_2d[1:-1,1:-1] = 0\n",
+ "print(array_2d)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a88b29fe",
+ "metadata": {},
+ "source": [
+ "### 18. eye: Another way of printing identity matrix"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 143,
+ "id": "19600f10",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[1., 0., 0., 0., 0., 0.],\n",
+ " [0., 1., 0., 0., 0., 0.],\n",
+ " [0., 0., 1., 0., 0., 0.],\n",
+ " [0., 0., 0., 1., 0., 0.],\n",
+ " [0., 0., 0., 0., 1., 0.],\n",
+ " [0., 0., 0., 0., 0., 1.]])"
+ ]
+ },
+ "execution_count": 143,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.eye(6)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8b8dbff8",
+ "metadata": {},
+ "source": [
+ "### 19. linspace: Return evenly spaced numbers over a specified interval."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 144,
+ "id": "043bd1ce",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([ 0., 5., 10.])"
+ ]
+ },
+ "execution_count": 144,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.linspace(0,10,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "bebae02a",
+ "metadata": {},
+ "source": [
+ "### 20. printing all zeros arrays"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 151,
+ "id": "b3de3a2f",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([0., 0., 0.])"
+ ]
+ },
+ "execution_count": 151,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.zeros((3))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "bb3a72a3",
+ "metadata": {},
+ "source": [
+ "# 20 FUNCTIONS IN PANDAS"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "id": "e80da545",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import pandas as pd"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b18d6183",
+ "metadata": {},
+ "source": [
+ "### 1. Creating a table from the scratch using dictionary"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "id": "8238a201",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "Table = {\"Names\": [\"Chisom\", \"Ugomsi\", \"Nneka\", \"Oge\", \"Blessing\"],\n",
+ " \"Age\":[25, 1, 23, 24, 22],\n",
+ " \"States\": [\"Enugu\", \"Enugu\", \"Anambra\", \"Ebonyi\", \"Abia\"]}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "id": "19e37430",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df = pd.DataFrame(Table)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "id": "13d61a32",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Names | \n",
+ " Age | \n",
+ " States | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Chisom | \n",
+ " 25 | \n",
+ " Enugu | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Ugomsi | \n",
+ " 1 | \n",
+ " Enugu | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " Nneka | \n",
+ " 23 | \n",
+ " Anambra | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Oge | \n",
+ " 24 | \n",
+ " Ebonyi | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Blessing | \n",
+ " 22 | \n",
+ " Abia | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Names Age States\n",
+ "0 Chisom 25 Enugu\n",
+ "1 Ugomsi 1 Enugu\n",
+ "2 Nneka 23 Anambra\n",
+ "3 Oge 24 Ebonyi\n",
+ "4 Blessing 22 Abia"
+ ]
+ },
+ "execution_count": 20,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "124e2365",
+ "metadata": {},
+ "source": [
+ "### 2. Sum: Return the sum of the values over the requested axis.\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "id": "3f928530",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "95"
+ ]
+ },
+ "execution_count": 24,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[\"Age\"].sum ()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "id": "8fd4bb5d",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "26"
+ ]
+ },
+ "execution_count": 28,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[\"Age\"][0:2].sum()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8e731ae9",
+ "metadata": {},
+ "source": [
+ "### 3. Mean: Return the mean of the values over the requested axis."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "id": "1f055426",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "19.0"
+ ]
+ },
+ "execution_count": 34,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[\"Age\"].mean()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e111b5a0",
+ "metadata": {},
+ "source": [
+ "### 4. Min: Return the minimum of the values over the requested axis.\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 36,
+ "id": "94153215",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "1"
+ ]
+ },
+ "execution_count": 36,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[\"Age\"].min()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "43e802a2",
+ "metadata": {},
+ "source": [
+ "### 5. Max: Return the maximum of the values over the requested axis."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 37,
+ "id": "3f2adada",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "25"
+ ]
+ },
+ "execution_count": 37,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[\"Age\"].max()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ac8b98b8",
+ "metadata": {},
+ "source": [
+ "### 6. Count: Count non-NA cells for each column or row."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 42,
+ "id": "ee7acc07",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "5"
+ ]
+ },
+ "execution_count": 42,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[\"Age\"].count()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "4c486c9c",
+ "metadata": {},
+ "source": [
+ "### 7. df.columns: Used to find the columns on the table"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 50,
+ "id": "c46389e7",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Index(['Names', 'Age', 'States'], dtype='object')"
+ ]
+ },
+ "execution_count": 50,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.columns"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "287aeaf8",
+ "metadata": {},
+ "source": [
+ "### 8. Loc: Access a group of rows and columns by label(s) or a boolean array.\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 55,
+ "id": "c8114a90",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Names Chisom\n",
+ "Age 25\n",
+ "States Enugu\n",
+ "Name: 0, dtype: object"
+ ]
+ },
+ "execution_count": 55,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.loc[0]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 67,
+ "id": "4416269f",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "0 Chisom\n",
+ "1 Ugomsi\n",
+ "2 Nneka\n",
+ "Name: Names, dtype: object"
+ ]
+ },
+ "execution_count": 67,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.loc[0:2, \"Names\"]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fbe1419d",
+ "metadata": {},
+ "source": [
+ "### 9. iloc: Purely integer-location based indexing for selection by position.\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 69,
+ "id": "eeb3694b",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Names | \n",
+ " Age | \n",
+ " States | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Chisom | \n",
+ " 25 | \n",
+ " Enugu | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Ugomsi | \n",
+ " 1 | \n",
+ " Enugu | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Names Age States\n",
+ "0 Chisom 25 Enugu\n",
+ "1 Ugomsi 1 Enugu"
+ ]
+ },
+ "execution_count": 69,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.iloc~[0:2]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d039dbab",
+ "metadata": {},
+ "source": [
+ "### 10. Where: Replace values where the condition is False.\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 61,
+ "id": "a6f3d93a",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "94.0"
+ ]
+ },
+ "execution_count": 61,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# method chaining (Equivalance of sumif)\n",
+ "df[\"Age\"].where(df[\"Age\"]>20).sum()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "45703af3",
+ "metadata": {},
+ "source": [
+ "### 11. Value_counts: Return a Series containing counts of unique rows in the DataFrame.\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 63,
+ "id": "2519ff48",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "25.0 1\n",
+ "23.0 1\n",
+ "24.0 1\n",
+ "22.0 1\n",
+ "Name: Age, dtype: int64"
+ ]
+ },
+ "execution_count": 63,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# method chain (Equivalance of countif)\n",
+ "df[\"Age\"].where(df[\"Age\"]>20).value_counts()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 64,
+ "id": "e1384c12",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "4"
+ ]
+ },
+ "execution_count": 64,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[\"Age\"].where(df[\"Age\"]>20).value_counts().sum()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5594d7d2",
+ "metadata": {},
+ "source": [
+ "### 12. Count: Count non-NA cells for each column or row."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 66,
+ "id": "8e37ff53",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "4"
+ ]
+ },
+ "execution_count": 66,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[\"Age\"].where(df[\"Age\"]>20).count()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "676a0c35",
+ "metadata": {},
+ "source": [
+ "### 13. pd.read: Read an Excel file into a pandas DataFrame."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 101,
+ "id": "839fe558",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df = pd.read_excel(\"Order sales pandas.xlsx\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fe0e8635",
+ "metadata": {},
+ "source": [
+ "### 14. head: This function returns the first `n` rows for the object based on position. It is useful for quickly testing if your object\n",
+ "### has the right type of data in it."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 108,
+ "id": "357fe0d1",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Order Quantity | \n",
+ " Sales | \n",
+ " Discount | \n",
+ " Ship Mode | \n",
+ " Profit | \n",
+ " Unit Price | \n",
+ " Shipping Cost | \n",
+ " Customer Name | \n",
+ " Province | \n",
+ " Region | \n",
+ " Customer Segment | \n",
+ " Product Category | \n",
+ " Product Sub-Category | \n",
+ " Product Name | \n",
+ " Product Container | \n",
+ " Product Base Margin | \n",
+ " Ship Date | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 6 | \n",
+ " 261.5400 | \n",
+ " 0.04 | \n",
+ " Regular Air | \n",
+ " -213.2500 | \n",
+ " 38.94 | \n",
+ " 35.00 | \n",
+ " Muhammed MacIntyre | \n",
+ " Nunavut | \n",
+ " Nunavut | \n",
+ " Small Business | \n",
+ " Office Supplies | \n",
+ " Storage & Organization | \n",
+ " Eldon Base for stackable storage shelf, platinum | \n",
+ " Large Box | \n",
+ " 0.80 | \n",
+ " 2010-10-20 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 49 | \n",
+ " 10123.0200 | \n",
+ " 0.07 | \n",
+ " Delivery Truck | \n",
+ " 457.8100 | \n",
+ " 208.16 | \n",
+ " 68.02 | \n",
+ " Barry French | \n",
+ " Nunavut | \n",
+ " Nunavut | \n",
+ " Consumer | \n",
+ " Office Supplies | \n",
+ " Appliances | \n",
+ " 1.7 Cubic Foot Compact \"Cube\" Office Refrigera... | \n",
+ " Jumbo Drum | \n",
+ " 0.58 | \n",
+ " 2012-10-02 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 27 | \n",
+ " 244.5700 | \n",
+ " 0.01 | \n",
+ " Regular Air | \n",
+ " 46.7075 | \n",
+ " 8.69 | \n",
+ " 2.99 | \n",
+ " Barry French | \n",
+ " Nunavut | \n",
+ " Nunavut | \n",
+ " Consumer | \n",
+ " Office Supplies | \n",
+ " Binders and Binder Accessories | \n",
+ " Cardinal Slant-D® Ring Binder, Heavy Gauge Vinyl | \n",
+ " Small Box | \n",
+ " 0.39 | \n",
+ " 2012-10-03 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 30 | \n",
+ " 4965.7595 | \n",
+ " 0.08 | \n",
+ " Regular Air | \n",
+ " 1198.9710 | \n",
+ " 195.99 | \n",
+ " 3.99 | \n",
+ " Clay Rozendal | \n",
+ " Nunavut | \n",
+ " Nunavut | \n",
+ " Corporate | \n",
+ " Technology | \n",
+ " Telephones and Communication | \n",
+ " R380 | \n",
+ " Small Box | \n",
+ " 0.58 | \n",
+ " 2011-07-12 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 19 | \n",
+ " 394.2700 | \n",
+ " 0.08 | \n",
+ " Regular Air | \n",
+ " 30.9400 | \n",
+ " 21.78 | \n",
+ " 5.94 | \n",
+ " Carlos Soltero | \n",
+ " Nunavut | \n",
+ " Nunavut | \n",
+ " Consumer | \n",
+ " Office Supplies | \n",
+ " Appliances | \n",
+ " Holmes HEPA Air Purifier | \n",
+ " Medium Box | \n",
+ " 0.50 | \n",
+ " 2010-08-30 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Order Quantity Sales Discount Ship Mode Profit \\\n",
+ "0 6 261.5400 0.04 Regular Air -213.2500 \n",
+ "1 49 10123.0200 0.07 Delivery Truck 457.8100 \n",
+ "2 27 244.5700 0.01 Regular Air 46.7075 \n",
+ "3 30 4965.7595 0.08 Regular Air 1198.9710 \n",
+ "4 19 394.2700 0.08 Regular Air 30.9400 \n",
+ "\n",
+ " Unit Price Shipping Cost Customer Name Province Region \\\n",
+ "0 38.94 35.00 Muhammed MacIntyre Nunavut Nunavut \n",
+ "1 208.16 68.02 Barry French Nunavut Nunavut \n",
+ "2 8.69 2.99 Barry French Nunavut Nunavut \n",
+ "3 195.99 3.99 Clay Rozendal Nunavut Nunavut \n",
+ "4 21.78 5.94 Carlos Soltero Nunavut Nunavut \n",
+ "\n",
+ " Customer Segment Product Category Product Sub-Category \\\n",
+ "0 Small Business Office Supplies Storage & Organization \n",
+ "1 Consumer Office Supplies Appliances \n",
+ "2 Consumer Office Supplies Binders and Binder Accessories \n",
+ "3 Corporate Technology Telephones and Communication \n",
+ "4 Consumer Office Supplies Appliances \n",
+ "\n",
+ " Product Name Product Container \\\n",
+ "0 Eldon Base for stackable storage shelf, platinum Large Box \n",
+ "1 1.7 Cubic Foot Compact \"Cube\" Office Refrigera... Jumbo Drum \n",
+ "2 Cardinal Slant-D® Ring Binder, Heavy Gauge Vinyl Small Box \n",
+ "3 R380 Small Box \n",
+ "4 Holmes HEPA Air Purifier Medium Box \n",
+ "\n",
+ " Product Base Margin Ship Date \n",
+ "0 0.80 2010-10-20 \n",
+ "1 0.58 2012-10-02 \n",
+ "2 0.39 2012-10-03 \n",
+ "3 0.58 2011-07-12 \n",
+ "4 0.50 2010-08-30 "
+ ]
+ },
+ "execution_count": 108,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "081be31d",
+ "metadata": {},
+ "source": [
+ "### 15. info: Print a concise summary of a DataFrame."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 105,
+ "id": "6beb9c60",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "RangeIndex: 8399 entries, 0 to 8398\n",
+ "Data columns (total 17 columns):\n",
+ " # Column Non-Null Count Dtype \n",
+ "--- ------ -------------- ----- \n",
+ " 0 Order Quantity 8399 non-null int64 \n",
+ " 1 Sales 8399 non-null float64 \n",
+ " 2 Discount 8399 non-null float64 \n",
+ " 3 Ship Mode 8399 non-null object \n",
+ " 4 Profit 8399 non-null float64 \n",
+ " 5 Unit Price 8399 non-null float64 \n",
+ " 6 Shipping Cost 8399 non-null float64 \n",
+ " 7 Customer Name 8399 non-null object \n",
+ " 8 Province 8399 non-null object \n",
+ " 9 Region 8399 non-null object \n",
+ " 10 Customer Segment 8399 non-null object \n",
+ " 11 Product Category 8399 non-null object \n",
+ " 12 Product Sub-Category 8399 non-null object \n",
+ " 13 Product Name 8399 non-null object \n",
+ " 14 Product Container 8399 non-null object \n",
+ " 15 Product Base Margin 8336 non-null float64 \n",
+ " 16 Ship Date 8399 non-null datetime64[ns]\n",
+ "dtypes: datetime64[ns](1), float64(6), int64(1), object(9)\n",
+ "memory usage: 1.1+ MB\n"
+ ]
+ }
+ ],
+ "source": [
+ "df.info()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1bf50863",
+ "metadata": {},
+ "source": [
+ "### 16. Shape: Return a tuple representing the dimensionality of the DataFrame."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 114,
+ "id": "3ef2fa36",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(8399, 17)"
+ ]
+ },
+ "execution_count": 114,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c52a06d6",
+ "metadata": {},
+ "source": [
+ "### 17. Size: Return an int representing the number of elements in this object."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 115,
+ "id": "704c557f",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "142783"
+ ]
+ },
+ "execution_count": 115,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.size"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b12d6c54",
+ "metadata": {},
+ "source": [
+ "### 18. Sample: Return a random sample of items from an axis of object."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 116,
+ "id": "445c4582",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Order Quantity | \n",
+ " Sales | \n",
+ " Discount | \n",
+ " Ship Mode | \n",
+ " Profit | \n",
+ " Unit Price | \n",
+ " Shipping Cost | \n",
+ " Customer Name | \n",
+ " Province | \n",
+ " Region | \n",
+ " Customer Segment | \n",
+ " Product Category | \n",
+ " Product Sub-Category | \n",
+ " Product Name | \n",
+ " Product Container | \n",
+ " Product Base Margin | \n",
+ " Ship Date | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 5706 | \n",
+ " 7 | \n",
+ " 189.7300 | \n",
+ " 0.01 | \n",
+ " Regular Air | \n",
+ " 43.1715 | \n",
+ " 24.95 | \n",
+ " 2.99 | \n",
+ " Jennifer Jackson | \n",
+ " Saskachewan | \n",
+ " Prarie | \n",
+ " Home Office | \n",
+ " Office Supplies | \n",
+ " Binders and Binder Accessories | \n",
+ " Large Capacity Hanging Post Binders | \n",
+ " Small Box | \n",
+ " 0.39 | \n",
+ " 2011-05-21 | \n",
+ "
\n",
+ " \n",
+ " | 1772 | \n",
+ " 13 | \n",
+ " 728.0250 | \n",
+ " 0.04 | \n",
+ " Regular Air | \n",
+ " 19.9980 | \n",
+ " 65.99 | \n",
+ " 2.50 | \n",
+ " Duane Benoit | \n",
+ " Ontario | \n",
+ " Ontario | \n",
+ " Home Office | \n",
+ " Technology | \n",
+ " Telephones and Communication | \n",
+ " 6000 | \n",
+ " Small Box | \n",
+ " 0.55 | \n",
+ " 2012-03-27 | \n",
+ "
\n",
+ " \n",
+ " | 2411 | \n",
+ " 50 | \n",
+ " 196.3900 | \n",
+ " 0.07 | \n",
+ " Regular Air | \n",
+ " 82.6000 | \n",
+ " 4.13 | \n",
+ " 0.50 | \n",
+ " George Ashbrook | \n",
+ " Ontario | \n",
+ " Ontario | \n",
+ " Consumer | \n",
+ " Office Supplies | \n",
+ " Labels | \n",
+ " Avery 506 | \n",
+ " Small Box | \n",
+ " 0.39 | \n",
+ " 2011-02-18 | \n",
+ "
\n",
+ " \n",
+ " | 7964 | \n",
+ " 36 | \n",
+ " 1921.1275 | \n",
+ " 0.08 | \n",
+ " Regular Air | \n",
+ " 248.5800 | \n",
+ " 65.99 | \n",
+ " 8.99 | \n",
+ " Claire Good | \n",
+ " Alberta | \n",
+ " West | \n",
+ " Home Office | \n",
+ " Technology | \n",
+ " Telephones and Communication | \n",
+ " Talkabout T8367 | \n",
+ " Small Box | \n",
+ " 0.56 | \n",
+ " 2012-02-29 | \n",
+ "
\n",
+ " \n",
+ " | 4329 | \n",
+ " 47 | \n",
+ " 1291.3500 | \n",
+ " 0.04 | \n",
+ " Regular Air | \n",
+ " 479.6200 | \n",
+ " 26.38 | \n",
+ " 5.86 | \n",
+ " Odella Nelson | \n",
+ " Ontario | \n",
+ " Ontario | \n",
+ " Small Business | \n",
+ " Office Supplies | \n",
+ " Paper | \n",
+ " Xerox 1935 | \n",
+ " Small Box | \n",
+ " 0.39 | \n",
+ " 2010-07-27 | \n",
+ "
\n",
+ " \n",
+ " | 3099 | \n",
+ " 30 | \n",
+ " 257.4200 | \n",
+ " 0.01 | \n",
+ " Regular Air | \n",
+ " 59.1800 | \n",
+ " 8.01 | \n",
+ " 2.87 | \n",
+ " Sanjit Jacobs | \n",
+ " Quebec | \n",
+ " Quebec | \n",
+ " Consumer | \n",
+ " Office Supplies | \n",
+ " Paper | \n",
+ " TOPS Money Receipt Book, Consecutively Numbere... | \n",
+ " Wrap Bag | \n",
+ " 0.40 | \n",
+ " 2009-01-18 | \n",
+ "
\n",
+ " \n",
+ " | 2199 | \n",
+ " 7 | \n",
+ " 81.5800 | \n",
+ " 0.04 | \n",
+ " Regular Air | \n",
+ " -7.7800 | \n",
+ " 10.98 | \n",
+ " 3.37 | \n",
+ " Edward Nazzal | \n",
+ " Ontario | \n",
+ " Ontario | \n",
+ " Home Office | \n",
+ " Office Supplies | \n",
+ " Scissors, Rulers and Trimmers | \n",
+ " Fiskars® Softgrip Scissors | \n",
+ " Small Pack | \n",
+ " 0.57 | \n",
+ " 2012-03-27 | \n",
+ "
\n",
+ " \n",
+ " | 2143 | \n",
+ " 28 | \n",
+ " 1642.0500 | \n",
+ " 0.03 | \n",
+ " Regular Air | \n",
+ " 829.7300 | \n",
+ " 55.98 | \n",
+ " 4.86 | \n",
+ " Linda Cazamias | \n",
+ " Ontario | \n",
+ " Ontario | \n",
+ " Corporate | \n",
+ " Office Supplies | \n",
+ " Paper | \n",
+ " Xerox 1908 | \n",
+ " Small Box | \n",
+ " 0.36 | \n",
+ " 2009-09-20 | \n",
+ "
\n",
+ " \n",
+ " | 1059 | \n",
+ " 17 | \n",
+ " 2285.1200 | \n",
+ " 0.08 | \n",
+ " Delivery Truck | \n",
+ " -455.8000 | \n",
+ " 140.98 | \n",
+ " 36.09 | \n",
+ " Khloe Miller | \n",
+ " British Columbia | \n",
+ " West | \n",
+ " Home Office | \n",
+ " Furniture | \n",
+ " Bookcases | \n",
+ " Sauder Forest Hills Library, Woodland Oak Finish | \n",
+ " Jumbo Box | \n",
+ " 0.77 | \n",
+ " 2010-12-27 | \n",
+ "
\n",
+ " \n",
+ " | 6147 | \n",
+ " 19 | \n",
+ " 6991.6500 | \n",
+ " 0.08 | \n",
+ " Delivery Truck | \n",
+ " 906.8000 | \n",
+ " 399.98 | \n",
+ " 12.06 | \n",
+ " Andy Gerbode | \n",
+ " Saskachewan | \n",
+ " Prarie | \n",
+ " Consumer | \n",
+ " Technology | \n",
+ " Office Machines | \n",
+ " Okidata ML320 Series Turbo Dot Matrix Printers | \n",
+ " Jumbo Box | \n",
+ " 0.56 | \n",
+ " 2009-01-18 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Order Quantity Sales Discount Ship Mode Profit \\\n",
+ "5706 7 189.7300 0.01 Regular Air 43.1715 \n",
+ "1772 13 728.0250 0.04 Regular Air 19.9980 \n",
+ "2411 50 196.3900 0.07 Regular Air 82.6000 \n",
+ "7964 36 1921.1275 0.08 Regular Air 248.5800 \n",
+ "4329 47 1291.3500 0.04 Regular Air 479.6200 \n",
+ "3099 30 257.4200 0.01 Regular Air 59.1800 \n",
+ "2199 7 81.5800 0.04 Regular Air -7.7800 \n",
+ "2143 28 1642.0500 0.03 Regular Air 829.7300 \n",
+ "1059 17 2285.1200 0.08 Delivery Truck -455.8000 \n",
+ "6147 19 6991.6500 0.08 Delivery Truck 906.8000 \n",
+ "\n",
+ " Unit Price Shipping Cost Customer Name Province Region \\\n",
+ "5706 24.95 2.99 Jennifer Jackson Saskachewan Prarie \n",
+ "1772 65.99 2.50 Duane Benoit Ontario Ontario \n",
+ "2411 4.13 0.50 George Ashbrook Ontario Ontario \n",
+ "7964 65.99 8.99 Claire Good Alberta West \n",
+ "4329 26.38 5.86 Odella Nelson Ontario Ontario \n",
+ "3099 8.01 2.87 Sanjit Jacobs Quebec Quebec \n",
+ "2199 10.98 3.37 Edward Nazzal Ontario Ontario \n",
+ "2143 55.98 4.86 Linda Cazamias Ontario Ontario \n",
+ "1059 140.98 36.09 Khloe Miller British Columbia West \n",
+ "6147 399.98 12.06 Andy Gerbode Saskachewan Prarie \n",
+ "\n",
+ " Customer Segment Product Category Product Sub-Category \\\n",
+ "5706 Home Office Office Supplies Binders and Binder Accessories \n",
+ "1772 Home Office Technology Telephones and Communication \n",
+ "2411 Consumer Office Supplies Labels \n",
+ "7964 Home Office Technology Telephones and Communication \n",
+ "4329 Small Business Office Supplies Paper \n",
+ "3099 Consumer Office Supplies Paper \n",
+ "2199 Home Office Office Supplies Scissors, Rulers and Trimmers \n",
+ "2143 Corporate Office Supplies Paper \n",
+ "1059 Home Office Furniture Bookcases \n",
+ "6147 Consumer Technology Office Machines \n",
+ "\n",
+ " Product Name Product Container \\\n",
+ "5706 Large Capacity Hanging Post Binders Small Box \n",
+ "1772 6000 Small Box \n",
+ "2411 Avery 506 Small Box \n",
+ "7964 Talkabout T8367 Small Box \n",
+ "4329 Xerox 1935 Small Box \n",
+ "3099 TOPS Money Receipt Book, Consecutively Numbere... Wrap Bag \n",
+ "2199 Fiskars® Softgrip Scissors Small Pack \n",
+ "2143 Xerox 1908 Small Box \n",
+ "1059 Sauder Forest Hills Library, Woodland Oak Finish Jumbo Box \n",
+ "6147 Okidata ML320 Series Turbo Dot Matrix Printers Jumbo Box \n",
+ "\n",
+ " Product Base Margin Ship Date \n",
+ "5706 0.39 2011-05-21 \n",
+ "1772 0.55 2012-03-27 \n",
+ "2411 0.39 2011-02-18 \n",
+ "7964 0.56 2012-02-29 \n",
+ "4329 0.39 2010-07-27 \n",
+ "3099 0.40 2009-01-18 \n",
+ "2199 0.57 2012-03-27 \n",
+ "2143 0.36 2009-09-20 \n",
+ "1059 0.77 2010-12-27 \n",
+ "6147 0.56 2009-01-18 "
+ ]
+ },
+ "execution_count": 116,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.sample(n=10)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1a7ca353",
+ "metadata": {},
+ "source": [
+ "### 19. Describe: Generate descriptive statistics.Descriptive statistics include those that summarize the central\n",
+ "### tendency, dispersion and shape of a\n",
+ "### dataset's distribution, excluding ``NaN`` values."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 117,
+ "id": "1100a487",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Order Quantity | \n",
+ " Sales | \n",
+ " Discount | \n",
+ " Profit | \n",
+ " Unit Price | \n",
+ " Shipping Cost | \n",
+ " Product Base Margin | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | count | \n",
+ " 8399.000000 | \n",
+ " 8399.000000 | \n",
+ " 8399.000000 | \n",
+ " 8399.000000 | \n",
+ " 8399.000000 | \n",
+ " 8399.000000 | \n",
+ " 8336.000000 | \n",
+ "
\n",
+ " \n",
+ " | mean | \n",
+ " 25.571735 | \n",
+ " 1775.878179 | \n",
+ " 0.049671 | \n",
+ " 181.184422 | \n",
+ " 89.346259 | \n",
+ " 12.838557 | \n",
+ " 0.512513 | \n",
+ "
\n",
+ " \n",
+ " | std | \n",
+ " 14.481071 | \n",
+ " 3585.050525 | \n",
+ " 0.031823 | \n",
+ " 1196.653326 | \n",
+ " 290.354383 | \n",
+ " 17.264052 | \n",
+ " 0.135589 | \n",
+ "
\n",
+ " \n",
+ " | min | \n",
+ " 1.000000 | \n",
+ " 2.240000 | \n",
+ " 0.000000 | \n",
+ " -14140.701600 | \n",
+ " 0.990000 | \n",
+ " 0.490000 | \n",
+ " 0.350000 | \n",
+ "
\n",
+ " \n",
+ " | 25% | \n",
+ " 13.000000 | \n",
+ " 143.195000 | \n",
+ " 0.020000 | \n",
+ " -83.315000 | \n",
+ " 6.480000 | \n",
+ " 3.300000 | \n",
+ " 0.380000 | \n",
+ "
\n",
+ " \n",
+ " | 50% | \n",
+ " 26.000000 | \n",
+ " 449.420000 | \n",
+ " 0.050000 | \n",
+ " -1.500000 | \n",
+ " 20.990000 | \n",
+ " 6.070000 | \n",
+ " 0.520000 | \n",
+ "
\n",
+ " \n",
+ " | 75% | \n",
+ " 38.000000 | \n",
+ " 1709.320000 | \n",
+ " 0.080000 | \n",
+ " 162.748000 | \n",
+ " 85.990000 | \n",
+ " 13.990000 | \n",
+ " 0.590000 | \n",
+ "
\n",
+ " \n",
+ " | max | \n",
+ " 50.000000 | \n",
+ " 89061.050000 | \n",
+ " 0.250000 | \n",
+ " 27220.690000 | \n",
+ " 6783.020000 | \n",
+ " 164.730000 | \n",
+ " 0.850000 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Order Quantity Sales Discount Profit Unit Price \\\n",
+ "count 8399.000000 8399.000000 8399.000000 8399.000000 8399.000000 \n",
+ "mean 25.571735 1775.878179 0.049671 181.184422 89.346259 \n",
+ "std 14.481071 3585.050525 0.031823 1196.653326 290.354383 \n",
+ "min 1.000000 2.240000 0.000000 -14140.701600 0.990000 \n",
+ "25% 13.000000 143.195000 0.020000 -83.315000 6.480000 \n",
+ "50% 26.000000 449.420000 0.050000 -1.500000 20.990000 \n",
+ "75% 38.000000 1709.320000 0.080000 162.748000 85.990000 \n",
+ "max 50.000000 89061.050000 0.250000 27220.690000 6783.020000 \n",
+ "\n",
+ " Shipping Cost Product Base Margin \n",
+ "count 8399.000000 8336.000000 \n",
+ "mean 12.838557 0.512513 \n",
+ "std 17.264052 0.135589 \n",
+ "min 0.490000 0.350000 \n",
+ "25% 3.300000 0.380000 \n",
+ "50% 6.070000 0.520000 \n",
+ "75% 13.990000 0.590000 \n",
+ "max 164.730000 0.850000 "
+ ]
+ },
+ "execution_count": 117,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.describe()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 155,
+ "id": "086f1b9f",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " count | \n",
+ " mean | \n",
+ " std | \n",
+ " min | \n",
+ " 25% | \n",
+ " 50% | \n",
+ " 75% | \n",
+ " max | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | Order Quantity | \n",
+ " 8399.0 | \n",
+ " 25.571735 | \n",
+ " 14.481071 | \n",
+ " 1.0000 | \n",
+ " 13.000 | \n",
+ " 26.00 | \n",
+ " 38.000 | \n",
+ " 50.00 | \n",
+ "
\n",
+ " \n",
+ " | Sales | \n",
+ " 8399.0 | \n",
+ " 1775.878179 | \n",
+ " 3585.050525 | \n",
+ " 2.2400 | \n",
+ " 143.195 | \n",
+ " 449.42 | \n",
+ " 1709.320 | \n",
+ " 89061.05 | \n",
+ "
\n",
+ " \n",
+ " | Discount | \n",
+ " 8399.0 | \n",
+ " 0.049671 | \n",
+ " 0.031823 | \n",
+ " 0.0000 | \n",
+ " 0.020 | \n",
+ " 0.05 | \n",
+ " 0.080 | \n",
+ " 0.25 | \n",
+ "
\n",
+ " \n",
+ " | Profit | \n",
+ " 8399.0 | \n",
+ " 181.184422 | \n",
+ " 1196.653326 | \n",
+ " -14140.7016 | \n",
+ " -83.315 | \n",
+ " -1.50 | \n",
+ " 162.748 | \n",
+ " 27220.69 | \n",
+ "
\n",
+ " \n",
+ " | Unit Price | \n",
+ " 8399.0 | \n",
+ " 89.346259 | \n",
+ " 290.354383 | \n",
+ " 0.9900 | \n",
+ " 6.480 | \n",
+ " 20.99 | \n",
+ " 85.990 | \n",
+ " 6783.02 | \n",
+ "
\n",
+ " \n",
+ " | Shipping Cost | \n",
+ " 8399.0 | \n",
+ " 12.838557 | \n",
+ " 17.264052 | \n",
+ " 0.4900 | \n",
+ " 3.300 | \n",
+ " 6.07 | \n",
+ " 13.990 | \n",
+ " 164.73 | \n",
+ "
\n",
+ " \n",
+ " | Product Base Margin | \n",
+ " 8336.0 | \n",
+ " 0.512513 | \n",
+ " 0.135589 | \n",
+ " 0.3500 | \n",
+ " 0.380 | \n",
+ " 0.52 | \n",
+ " 0.590 | \n",
+ " 0.85 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " count mean std min 25% \\\n",
+ "Order Quantity 8399.0 25.571735 14.481071 1.0000 13.000 \n",
+ "Sales 8399.0 1775.878179 3585.050525 2.2400 143.195 \n",
+ "Discount 8399.0 0.049671 0.031823 0.0000 0.020 \n",
+ "Profit 8399.0 181.184422 1196.653326 -14140.7016 -83.315 \n",
+ "Unit Price 8399.0 89.346259 290.354383 0.9900 6.480 \n",
+ "Shipping Cost 8399.0 12.838557 17.264052 0.4900 3.300 \n",
+ "Product Base Margin 8336.0 0.512513 0.135589 0.3500 0.380 \n",
+ "\n",
+ " 50% 75% max \n",
+ "Order Quantity 26.00 38.000 50.00 \n",
+ "Sales 449.42 1709.320 89061.05 \n",
+ "Discount 0.05 0.080 0.25 \n",
+ "Profit -1.50 162.748 27220.69 \n",
+ "Unit Price 20.99 85.990 6783.02 \n",
+ "Shipping Cost 6.07 13.990 164.73 \n",
+ "Product Base Margin 0.52 0.590 0.85 "
+ ]
+ },
+ "execution_count": 155,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# For Transposing\n",
+ "df.describe().T"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "3f2ae6d9",
+ "metadata": {},
+ "source": [
+ "### 20. nunique: Count number of distinct elements in specified axis."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 159,
+ "id": "704e9281",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Order Quantity 50\n",
+ "Sales 8153\n",
+ "Discount 16\n",
+ "Ship Mode 3\n",
+ "Profit 7986\n",
+ "Unit Price 751\n",
+ "Shipping Cost 652\n",
+ "Customer Name 795\n",
+ "Province 13\n",
+ "Region 8\n",
+ "Customer Segment 4\n",
+ "Product Category 3\n",
+ "Product Sub-Category 17\n",
+ "Product Name 1263\n",
+ "Product Container 7\n",
+ "Product Base Margin 51\n",
+ "Ship Date 1450\n",
+ "dtype: int64"
+ ]
+ },
+ "execution_count": 159,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.nunique()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d5e4c056",
+ "metadata": {},
+ "source": [
+ "### 21.df.isna().any(): Detect missing values."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 161,
+ "id": "e8a49032",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Order Quantity False\n",
+ "Sales False\n",
+ "Discount False\n",
+ "Ship Mode False\n",
+ "Profit False\n",
+ "Unit Price False\n",
+ "Shipping Cost False\n",
+ "Customer Name False\n",
+ "Province False\n",
+ "Region False\n",
+ "Customer Segment False\n",
+ "Product Category False\n",
+ "Product Sub-Category False\n",
+ "Product Name False\n",
+ "Product Container False\n",
+ "Product Base Margin True\n",
+ "Ship Date False\n",
+ "dtype: bool"
+ ]
+ },
+ "execution_count": 161,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.isna().any()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d17b852a",
+ "metadata": {},
+ "source": [
+ "### 22. isnull: Detect missing values."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 163,
+ "id": "48b2a0ca",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Order Quantity | \n",
+ " Sales | \n",
+ " Discount | \n",
+ " Ship Mode | \n",
+ " Profit | \n",
+ " Unit Price | \n",
+ " Shipping Cost | \n",
+ " Customer Name | \n",
+ " Province | \n",
+ " Region | \n",
+ " Customer Segment | \n",
+ " Product Category | \n",
+ " Product Sub-Category | \n",
+ " Product Name | \n",
+ " Product Container | \n",
+ " Product Base Margin | \n",
+ " Ship Date | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 8394 | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 8395 | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 8396 | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 8397 | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 8398 | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
8399 rows × 17 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Order Quantity Sales Discount Ship Mode Profit Unit Price \\\n",
+ "0 False False False False False False \n",
+ "1 False False False False False False \n",
+ "2 False False False False False False \n",
+ "3 False False False False False False \n",
+ "4 False False False False False False \n",
+ "... ... ... ... ... ... ... \n",
+ "8394 False False False False False False \n",
+ "8395 False False False False False False \n",
+ "8396 False False False False False False \n",
+ "8397 False False False False False False \n",
+ "8398 False False False False False False \n",
+ "\n",
+ " Shipping Cost Customer Name Province Region Customer Segment \\\n",
+ "0 False False False False False \n",
+ "1 False False False False False \n",
+ "2 False False False False False \n",
+ "3 False False False False False \n",
+ "4 False False False False False \n",
+ "... ... ... ... ... ... \n",
+ "8394 False False False False False \n",
+ "8395 False False False False False \n",
+ "8396 False False False False False \n",
+ "8397 False False False False False \n",
+ "8398 False False False False False \n",
+ "\n",
+ " Product Category Product Sub-Category Product Name Product Container \\\n",
+ "0 False False False False \n",
+ "1 False False False False \n",
+ "2 False False False False \n",
+ "3 False False False False \n",
+ "4 False False False False \n",
+ "... ... ... ... ... \n",
+ "8394 False False False False \n",
+ "8395 False False False False \n",
+ "8396 False False False False \n",
+ "8397 False False False False \n",
+ "8398 False False False False \n",
+ "\n",
+ " Product Base Margin Ship Date \n",
+ "0 False False \n",
+ "1 False False \n",
+ "2 False False \n",
+ "3 False False \n",
+ "4 False False \n",
+ "... ... ... \n",
+ "8394 False False \n",
+ "8395 False False \n",
+ "8396 False False \n",
+ "8397 False False \n",
+ "8398 False False \n",
+ "\n",
+ "[8399 rows x 17 columns]"
+ ]
+ },
+ "execution_count": 163,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.isnull()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "bfb7781d",
+ "metadata": {},
+ "source": [
+ "### 23. columns: Immutable sequence used for indexing and alignment. The basic object storing axis labels for all ### pandas objects."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 164,
+ "id": "084fe30d",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Index(['Order Quantity', 'Sales', 'Discount', 'Ship Mode', 'Profit',\n",
+ " 'Unit Price', 'Shipping Cost', 'Customer Name', 'Province', 'Region',\n",
+ " 'Customer Segment', 'Product Category', 'Product Sub-Category',\n",
+ " 'Product Name', 'Product Container', 'Product Base Margin',\n",
+ " 'Ship Date'],\n",
+ " dtype='object')"
+ ]
+ },
+ "execution_count": 164,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.columns"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "016c99d7",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "d041169e",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/Akpa Juliet Chisom WTF1.ipynb b/Akpa Juliet Chisom WTF1.ipynb
new file mode 100644
index 0000000..4aaa70b
--- /dev/null
+++ b/Akpa Juliet Chisom WTF1.ipynb
@@ -0,0 +1,360 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "60ea9d76",
+ "metadata": {},
+ "source": [
+ "### 1)Print all elements of a list using for loop."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "01538e9e",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "2\n",
+ "4\n",
+ "5\n",
+ "7\n",
+ "8\n",
+ "9\n",
+ "10\n"
+ ]
+ }
+ ],
+ "source": [
+ "listx = [2,4,5,7,8,9,10]\n",
+ "for x in listx:\n",
+ " print(x)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "df211034",
+ "metadata": {},
+ "source": [
+ "# 2)Using range(1,101), make two list, one containing all even numbers andother containing all odd numbers."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "63991d9d",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "even number [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100]\n",
+ "odd number [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99]\n"
+ ]
+ }
+ ],
+ "source": [
+ "numbers = range (1,101)\n",
+ "even_no = []\n",
+ "odd_no = []\n",
+ "for i in numbers:\n",
+ " if i % 2 == 0:\n",
+ " even_no. append(i)\n",
+ " else:\n",
+ " odd_no.append(i)\n",
+ "print(\"even number\", even_no)\n",
+ "print(\"odd number\", odd_no)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b0622138",
+ "metadata": {},
+ "source": [
+ "### 3)A company decided to give bonus of 5% to employee if his/her year of service is more than 5years. Ask user for their salary and year of service and print the net bonus amount. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "id": "e100a6f1",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "salary30000\n",
+ "year of service5\n",
+ "1500.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "salary = int(input(\"salary\"))\n",
+ "year = int(input('year of service'))\n",
+ "if year == 5:\n",
+ " print(salary * 0.05)\n",
+ "else:\n",
+ " print(\"not eligible\")\n",
+ " \n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "e411d4f6",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "salary50000\n",
+ "year of service5\n",
+ "2500.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "salary = int(input(\"salary\"))\n",
+ "year = int(input('year of service'))\n",
+ "if year == 5:\n",
+ " print(salary * 0.05)\n",
+ "else:\n",
+ " print(\"not eligible\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "91800f7a",
+ "metadata": {},
+ "source": [
+ "### 4)Take input of age of 3 people by user and determine oldest and youngest among them. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "d2a0d0fc",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "enter your age 20\n",
+ "enter your age 25\n",
+ "enter your age 1\n",
+ "\n",
+ "\n",
+ "oldest among them is 25\n",
+ "youngest among them is 1\n"
+ ]
+ }
+ ],
+ "source": [
+ "person1 = int(input(\"enter your age \"))\n",
+ "person2 = int(input(\"enter your age \"))\n",
+ "person3 = int(input(\"enter your age \"))\n",
+ "list = [person1, person2, person3]\n",
+ "print(\"\\n\")\n",
+ "print(\"oldest among them is \", max(list))\n",
+ "print(\"youngest among them is \", min(list))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "id": "b927c7ae",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Oldest among them is 25\n",
+ "Youngest among them is 1\n"
+ ]
+ }
+ ],
+ "source": [
+ "Age = {\"Chisom\": 25, \"Jennifer\": 20, \"Ugomsi\": 1}\n",
+ "Oldest = print(\"Oldest among them is\", max(Age.values()))\n",
+ "Youngest = print(\"Youngest among them is\", min(Age.values()))\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9abbf98e",
+ "metadata": {},
+ "source": [
+ "A school has following rules for grading system:\n",
+ "a. Below 25 - F\n",
+ "b. 25 to 45 - E\n",
+ "c. 45 to 50 - D\n",
+ "d. 50 to 60 - C\n",
+ "e. 60 to 80 - B\n",
+ "f. Above 80 - A\n",
+ "5) Ask user to enter marks and print the corresponding grade"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "8e8b5b73",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "45\n",
+ "E\n"
+ ]
+ }
+ ],
+ "source": [
+ "grades = int(input())\n",
+ "if grades < 25:\n",
+ " print(\"F\")\n",
+ "elif grades > 25 and grades <=45:\n",
+ " print(\"E\")\n",
+ "elif grades > 45 and grades <= 50:\n",
+ " print(\"D\")\n",
+ "elif grades > 50 and grades <= 60:\n",
+ " print(\"C\")\n",
+ "elif grades > 60 and grades <= 80:\n",
+ " print(\"B\")\n",
+ "elif grades > 80:\n",
+ " print(\"A\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0702b273",
+ "metadata": {},
+ "source": [
+ "### 6)Write a Python script to merge two Python dictionaries "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "618c88cc",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'Chisom': 25, 'Jennifer': 20, 'Ugomsi': 1, 'Nneka': 24, 'Oge': 23}\n"
+ ]
+ }
+ ],
+ "source": [
+ "age1 = {\"Chisom\": 25, \"Jennifer\": 20, \"Ugomsi\": 1}\n",
+ "age2 = {\"Nneka\": 24, \"Oge\": 23}\n",
+ "Age = age1.copy()\n",
+ "age1.update(age2)\n",
+ "print(age1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e3eedebb",
+ "metadata": {},
+ "source": [
+ "### 7)Write a Python program to remove a key from a dictionary."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "e76157f0",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'Chisom': 25, 'Jennifer': 20, 'Ugomsi': 1, 'Nneka': 24, 'Oge': 23}\n",
+ "{'Jennifer': 20, 'Ugomsi': 1, 'Nneka': 24, 'Oge': 23}\n"
+ ]
+ }
+ ],
+ "source": [
+ "age = {'Chisom': 25, 'Jennifer': 20, 'Ugomsi': 1, 'Nneka': 24, 'Oge': 23}\n",
+ "print(age)\n",
+ "if \"Chisom\" in age:\n",
+ " del age [\"Chisom\"]\n",
+ "print(age)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b036f74e",
+ "metadata": {},
+ "source": [
+ "### 8)Write a Python program to get the largest numberfrom a list"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "id": "596f0ec3",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "70\n"
+ ]
+ }
+ ],
+ "source": [
+ "def largest_no(list):\n",
+ " max = list[0]\n",
+ " for x in list:\n",
+ " if x > max:\n",
+ " max = x\n",
+ " return max\n",
+ "print(largest_no ([20,30,40,50,60,70]))\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "aedcd7c1",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "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.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}