|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 2, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "import pandas as pd\n", |
| 10 | + "import numpy as np\n", |
| 11 | + "import matplotlib.pyplot as plt" |
| 12 | + ] |
| 13 | + }, |
| 14 | + { |
| 15 | + "cell_type": "markdown", |
| 16 | + "metadata": {}, |
| 17 | + "source": [ |
| 18 | + "- Ways to create dataset\n", |
| 19 | + " - dictionary of items\n", |
| 20 | + " - list of items\n", |
| 21 | + " - importing csv files\n", |
| 22 | + " - importing excel files\n", |
| 23 | + " - importing json files\n", |
| 24 | + "- reading data\n", |
| 25 | + "- selection of data\n", |
| 26 | + "- manipulating the data\n", |
| 27 | + "- visualizing the data" |
| 28 | + ] |
| 29 | + }, |
| 30 | + { |
| 31 | + "cell_type": "code", |
| 32 | + "execution_count": 5, |
| 33 | + "metadata": {}, |
| 34 | + "outputs": [ |
| 35 | + { |
| 36 | + "data": { |
| 37 | + "text/html": [ |
| 38 | + "<div>\n", |
| 39 | + "<style scoped>\n", |
| 40 | + " .dataframe tbody tr th:only-of-type {\n", |
| 41 | + " vertical-align: middle;\n", |
| 42 | + " }\n", |
| 43 | + "\n", |
| 44 | + " .dataframe tbody tr th {\n", |
| 45 | + " vertical-align: top;\n", |
| 46 | + " }\n", |
| 47 | + "\n", |
| 48 | + " .dataframe thead th {\n", |
| 49 | + " text-align: right;\n", |
| 50 | + " }\n", |
| 51 | + "</style>\n", |
| 52 | + "<table border=\"1\" class=\"dataframe\">\n", |
| 53 | + " <thead>\n", |
| 54 | + " <tr style=\"text-align: right;\">\n", |
| 55 | + " <th></th>\n", |
| 56 | + " <th>Title</th>\n", |
| 57 | + " <th>Author</th>\n", |
| 58 | + " <th>Published</th>\n", |
| 59 | + " <th>price</th>\n", |
| 60 | + " </tr>\n", |
| 61 | + " </thead>\n", |
| 62 | + " <tbody>\n", |
| 63 | + " <tr>\n", |
| 64 | + " <th>0</th>\n", |
| 65 | + " <td>The Hobbit</td>\n", |
| 66 | + " <td>J.R.R Tolkien</td>\n", |
| 67 | + " <td>1937</td>\n", |
| 68 | + " <td>399</td>\n", |
| 69 | + " </tr>\n", |
| 70 | + " <tr>\n", |
| 71 | + " <th>1</th>\n", |
| 72 | + " <td>The Catcher in the Rye</td>\n", |
| 73 | + " <td>J.D Salinger</td>\n", |
| 74 | + " <td>1951</td>\n", |
| 75 | + " <td>199</td>\n", |
| 76 | + " </tr>\n", |
| 77 | + " <tr>\n", |
| 78 | + " <th>2</th>\n", |
| 79 | + " <td>1984</td>\n", |
| 80 | + " <td>George Orwell</td>\n", |
| 81 | + " <td>1949</td>\n", |
| 82 | + " <td>299</td>\n", |
| 83 | + " </tr>\n", |
| 84 | + " <tr>\n", |
| 85 | + " <th>3</th>\n", |
| 86 | + " <td>The Little Prince</td>\n", |
| 87 | + " <td>Antoine de Saint- Exupery</td>\n", |
| 88 | + " <td>1943</td>\n", |
| 89 | + " <td>199</td>\n", |
| 90 | + " </tr>\n", |
| 91 | + " <tr>\n", |
| 92 | + " <th>4</th>\n", |
| 93 | + " <td>The Da Vinci Code</td>\n", |
| 94 | + " <td>Dan Brown</td>\n", |
| 95 | + " <td>2003</td>\n", |
| 96 | + " <td>499</td>\n", |
| 97 | + " </tr>\n", |
| 98 | + " </tbody>\n", |
| 99 | + "</table>\n", |
| 100 | + "</div>" |
| 101 | + ], |
| 102 | + "text/plain": [ |
| 103 | + " Title Author Published price\n", |
| 104 | + "0 The Hobbit J.R.R Tolkien 1937 399\n", |
| 105 | + "1 The Catcher in the Rye J.D Salinger 1951 199\n", |
| 106 | + "2 1984 George Orwell 1949 299\n", |
| 107 | + "3 The Little Prince Antoine de Saint- Exupery 1943 199\n", |
| 108 | + "4 The Da Vinci Code Dan Brown 2003 499" |
| 109 | + ] |
| 110 | + }, |
| 111 | + "execution_count": 5, |
| 112 | + "metadata": {}, |
| 113 | + "output_type": "execute_result" |
| 114 | + } |
| 115 | + ], |
| 116 | + "source": [ |
| 117 | + "# creating dataset from dictionary items\n", |
| 118 | + "books ={\n", |
| 119 | + " 'Title': ['The Hobbit','The Catcher in the Rye','1984','The Little Prince','The Da Vinci Code'],\n", |
| 120 | + " 'Author':['J.R.R Tolkien','J.D Salinger','George Orwell','Antoine de Saint- Exupery','Dan Brown'],\n", |
| 121 | + " 'Published': [1937,1951,1949,1943,2003],\n", |
| 122 | + " 'price': [399,199,299,199,499]\n", |
| 123 | + "}\n", |
| 124 | + "pd.DataFrame(books)" |
| 125 | + ] |
| 126 | + }, |
| 127 | + { |
| 128 | + "cell_type": "code", |
| 129 | + "execution_count": null, |
| 130 | + "metadata": {}, |
| 131 | + "outputs": [], |
| 132 | + "source": [] |
| 133 | + } |
| 134 | + ], |
| 135 | + "metadata": { |
| 136 | + "kernelspec": { |
| 137 | + "display_name": "base", |
| 138 | + "language": "python", |
| 139 | + "name": "python3" |
| 140 | + }, |
| 141 | + "language_info": { |
| 142 | + "codemirror_mode": { |
| 143 | + "name": "ipython", |
| 144 | + "version": 3 |
| 145 | + }, |
| 146 | + "file_extension": ".py", |
| 147 | + "mimetype": "text/x-python", |
| 148 | + "name": "python", |
| 149 | + "nbconvert_exporter": "python", |
| 150 | + "pygments_lexer": "ipython3", |
| 151 | + "version": "3.12.4" |
| 152 | + } |
| 153 | + }, |
| 154 | + "nbformat": 4, |
| 155 | + "nbformat_minor": 2 |
| 156 | +} |
0 commit comments