Skip to content

Commit 0a8d825

Browse files
srinifysrinify
srinify
authored and
srinify
committed
modified SimpleFrame
1 parent 9c915d3 commit 0a8d825

File tree

1 file changed

+11
-30
lines changed

1 file changed

+11
-30
lines changed

Diff for: Mission304Solutions.ipynb

+11-30
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,9 @@
1111
"cell_type": "markdown",
1212
"metadata": {},
1313
"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",
3115
"\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",
3317
"\n",
3418
"To preview our data, we’ll need to:\n",
3519
"- Be able to view the first five rows\n",
@@ -79,27 +63,24 @@
7963
},
8064
{
8165
"cell_type": "code",
82-
"execution_count": 1,
66+
"execution_count": 2,
8367
"metadata": {},
8468
"outputs": [
8569
{
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"
9576
]
9677
}
9778
],
9879
"source": [
9980
"import csv\n",
10081
"from statistics import mean, stdev, median, mode\n",
10182
"\n",
102-
"class BabyPandas():\n",
83+
"class SimpleFrame():\n",
10384
" def __init__(self, filename):\n",
10485
" self.filename = filename\n",
10586
" \n",
@@ -191,7 +172,7 @@
191172
" col_data.append([row[1],row[2],row[column_index]])\n",
192173
" return max(col_data, key= lambda x: x[2])\n",
193174
" \n",
194-
"s = BabyPandas(\"music_data.csv\")\n",
175+
"s = SimpleFrame(\"music_data.csv\")\n",
195176
"s.read_data()\n",
196177
"\n",
197178
"s.shape()\n",

0 commit comments

Comments
 (0)