Queer European MD passionate about IT
Bläddra i källkod

modified SimpleFrame

srinify 6 år sedan
förälder
incheckning
0a8d82578e
1 ändrade filer med 11 tillägg och 30 borttagningar
  1. 11 30
      Mission304Solutions.ipynb

+ 11 - 30
Mission304Solutions.ipynb

@@ -11,25 +11,9 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "# Introduction"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "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",
-    "    - Which song had the highest number of plays in one day?\n",
-    "    - Which song had the lowest number of plays in one day?"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "# Specifications/Requirements\n",
+    "# Designing Our Class\n",
     "\n",
-    "BabyPandas should make it easy for us to load , preview, manipulate, and make calculations with our data. \n",
+    "SimpleFrame should make it easy for us to load , preview, manipulate, and make calculations with our data. \n",
     "\n",
     "To preview our data, we’ll need to:\n",
     "- Be able to view the first five rows\n",
@@ -79,19 +63,16 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": 2,
    "metadata": {},
    "outputs": [
     {
-     "ename": "FileNotFoundError",
-     "evalue": "[Errno 2] No such file or directory: 'music_data.csv'",
-     "output_type": "error",
-     "traceback": [
-      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
-      "\u001b[0;31mFileNotFoundError\u001b[0m                         Traceback (most recent call last)",
-      "\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",
-      "\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",
-      "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'music_data.csv'"
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "2\n",
+      "['Reggaetón Lento (Bailemos)', 'CNCO', '9998']\n",
+      "['Ay Mi Dios', 'IAmChino', '10000']\n"
      ]
     }
    ],
@@ -99,7 +80,7 @@
     "import csv\n",
     "from statistics import mean, stdev, median, mode\n",
     "\n",
-    "class BabyPandas():\n",
+    "class SimpleFrame():\n",
     "    def __init__(self, filename):\n",
     "        self.filename = filename\n",
     "    \n",
@@ -191,7 +172,7 @@
     "            col_data.append([row[1],row[2],row[column_index]])\n",
     "        return max(col_data, key= lambda x: x[2])\n",
     "    \n",
-    "s = BabyPandas(\"music_data.csv\")\n",
+    "s = SimpleFrame(\"music_data.csv\")\n",
     "s.read_data()\n",
     "\n",
     "s.shape()\n",