|
11 | 11 | "cell_type": "markdown",
|
12 | 12 | "metadata": {},
|
13 | 13 | "source": [
|
14 |
| - "# Introduction" |
15 |
| - ] |
16 |
| - }, |
17 |
| - { |
18 |
| - "cell_type": "markdown", |
19 |
| - "metadata": {}, |
20 |
| - "source": [ |
21 |
| - "In this project, we'll be building a mini-version of the Pandas class. The goal of this project, is to create a class that can perform basic Pandas functions. The questions we'll be answering in this project are: \n", |
22 |
| - " - Which song had the highest number of plays in one day?\n", |
23 |
| - " - Which song had the lowest number of plays in one day?" |
24 |
| - ] |
25 |
| - }, |
26 |
| - { |
27 |
| - "cell_type": "markdown", |
28 |
| - "metadata": {}, |
29 |
| - "source": [ |
30 |
| - "# Specifications/Requirements\n", |
| 14 | + "# Designing Our Class\n", |
31 | 15 | "\n",
|
32 |
| - "BabyPandas should make it easy for us to load , preview, manipulate, and make calculations with our data. \n", |
| 16 | + "SimpleFrame should make it easy for us to load , preview, manipulate, and make calculations with our data. \n", |
33 | 17 | "\n",
|
34 | 18 | "To preview our data, we’ll need to:\n",
|
35 | 19 | "- Be able to view the first five rows\n",
|
|
79 | 63 | },
|
80 | 64 | {
|
81 | 65 | "cell_type": "code",
|
82 |
| - "execution_count": 1, |
| 66 | + "execution_count": 2, |
83 | 67 | "metadata": {},
|
84 | 68 | "outputs": [
|
85 | 69 | {
|
86 |
| - "ename": "FileNotFoundError", |
87 |
| - "evalue": "[Errno 2] No such file or directory: 'music_data.csv'", |
88 |
| - "output_type": "error", |
89 |
| - "traceback": [ |
90 |
| - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
91 |
| - "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", |
92 |
| - "\u001b[0;32m<ipython-input-1-49ed6515bc96>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 95\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 96\u001b[0m \u001b[0ms\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mBabyPandas\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"music_data.csv\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 97\u001b[0;31m \u001b[0ms\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_data\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 99\u001b[0m \u001b[0ms\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", |
93 |
| - "\u001b[0;32m<ipython-input-1-49ed6515bc96>\u001b[0m in \u001b[0;36mread_data\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0mReads\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mopens\u001b[0m \u001b[0mthe\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m '''\n\u001b[0;32m---> 12\u001b[0;31m \u001b[0mf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\"r\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 13\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcsv\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreader\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", |
94 |
| - "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'music_data.csv'" |
| 70 | + "name": "stdout", |
| 71 | + "output_type": "stream", |
| 72 | + "text": [ |
| 73 | + "2\n", |
| 74 | + "['Reggaetón Lento (Bailemos)', 'CNCO', '9998']\n", |
| 75 | + "['Ay Mi Dios', 'IAmChino', '10000']\n" |
95 | 76 | ]
|
96 | 77 | }
|
97 | 78 | ],
|
98 | 79 | "source": [
|
99 | 80 | "import csv\n",
|
100 | 81 | "from statistics import mean, stdev, median, mode\n",
|
101 | 82 | "\n",
|
102 |
| - "class BabyPandas():\n", |
| 83 | + "class SimpleFrame():\n", |
103 | 84 | " def __init__(self, filename):\n",
|
104 | 85 | " self.filename = filename\n",
|
105 | 86 | " \n",
|
|
191 | 172 | " col_data.append([row[1],row[2],row[column_index]])\n",
|
192 | 173 | " return max(col_data, key= lambda x: x[2])\n",
|
193 | 174 | " \n",
|
194 |
| - "s = BabyPandas(\"music_data.csv\")\n", |
| 175 | + "s = SimpleFrame(\"music_data.csv\")\n", |
195 | 176 | "s.read_data()\n",
|
196 | 177 | "\n",
|
197 | 178 | "s.shape()\n",
|
|
0 commit comments