Skip to content

Commit d2c5612

Browse files
authored
Merge pull request guipsamora#14 from freddie71010/patch-1
Solutions Steps 9-12 corrected
2 parents 743d45a + 34ef6ef commit d2c5612

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

01_Getting_&_Knowing_Your_Data/Chipotle/Exercise_with_Solutions.ipynb

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@
362362
{
363363
"data": {
364364
"text/plain": [
365-
"Chicken Bowl 726\n",
366-
"Name: item_name, dtype: int64"
365+
"Chicken Bowl 761\n",
366+
"*Don't forget to include the quantity in your calculations!"
367367
]
368368
},
369369
"execution_count": 139,
@@ -372,7 +372,10 @@
372372
}
373373
],
374374
"source": [
375-
"chipo.item_name.value_counts().head(1)"
375+
"c = chipo.groupby('item_name')",
376+
"c = c.sum()",
377+
"c = c.sort_values(['quantity'], ascending=False)",
378+
"c.head(1)"
376379
]
377380
},
378381
{
@@ -392,7 +395,7 @@
392395
{
393396
"data": {
394397
"text/plain": [
395-
"726"
398+
"761"
396399
]
397400
},
398401
"execution_count": 93,
@@ -401,9 +404,11 @@
401404
}
402405
],
403406
"source": [
404-
"mostOrd = chipo.item_name.value_counts().max() #or mostOrd = chipo[\"item_name\"].max()\n",
405-
"mostOrd"
406-
]
407+
"c = chipo.groupby('item_name')",
408+
"c = c.sum()",
409+
"c = c.sort_values(['quantity'], ascending=False)",
410+
"c.head(1)"
411+
]
407412
},
408413
{
409414
"cell_type": "markdown",
@@ -422,11 +427,11 @@
422427
{
423428
"data": {
424429
"text/plain": [
425-
"[Diet Coke] 134\n",
426-
"[Coke] 123\n",
427-
"[Sprite] 77\n",
428-
"[Fresh Tomato Salsa, [Rice, Black Beans, Cheese, Sour Cream, Lettuce]] 42\n",
429-
"[Fresh Tomato Salsa, [Rice, Black Beans, Cheese, Sour Cream, Guacamole, Lettuce]] 40\n",
430+
"[Diet Coke] 159\n",
431+
"[Coke] 143\n",
432+
"[Sprite] 89\n",
433+
"[Fresh Tomato Salsa, [Rice, Black Beans, Cheese, Sour Cream, Lettuce]] 49\n",
434+
"[Fresh Tomato Salsa, [Rice, Black Beans, Cheese, Sour Cream]] 42\n",
430435
"Name: choice_description, dtype: int64"
431436
]
432437
},
@@ -436,7 +441,10 @@
436441
}
437442
],
438443
"source": [
439-
"chipo.choice_description.value_counts().head()"
444+
"c = chipo.groupby('choice_description').sum()",
445+
"c = c.sort_values(['quantity'], ascending=False)",
446+
"c.head(1)",
447+
"Diet Coke 159"
440448
]
441449
},
442450
{

0 commit comments

Comments
 (0)