|
362 | 362 | {
|
363 | 363 | "data": {
|
364 | 364 | "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!" |
367 | 367 | ]
|
368 | 368 | },
|
369 | 369 | "execution_count": 139,
|
|
372 | 372 | }
|
373 | 373 | ],
|
374 | 374 | "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)" |
376 | 379 | ]
|
377 | 380 | },
|
378 | 381 | {
|
|
392 | 395 | {
|
393 | 396 | "data": {
|
394 | 397 | "text/plain": [
|
395 |
| - "726" |
| 398 | + "761" |
396 | 399 | ]
|
397 | 400 | },
|
398 | 401 | "execution_count": 93,
|
|
401 | 404 | }
|
402 | 405 | ],
|
403 | 406 | "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 | + ] |
407 | 412 | },
|
408 | 413 | {
|
409 | 414 | "cell_type": "markdown",
|
|
422 | 427 | {
|
423 | 428 | "data": {
|
424 | 429 | "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", |
430 | 435 | "Name: choice_description, dtype: int64"
|
431 | 436 | ]
|
432 | 437 | },
|
|
436 | 441 | }
|
437 | 442 | ],
|
438 | 443 | "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" |
440 | 448 | ]
|
441 | 449 | },
|
442 | 450 | {
|
|
0 commit comments