{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "**This notebook is an exercise in the [Pandas](https://www.kaggle.com/learn/pandas) course. You can reference the tutorial at [this link](https://www.kaggle.com/residentmario/grouping-and-sorting).**\n", "\n", "---\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction\n", "\n", "In these exercises we'll apply groupwise analysis to our dataset.\n", "\n", "Run the code cell below to load the data before running the exercises." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Setup complete.\n" ] } ], "source": [ "import pandas as pd\n", "\n", "reviews = pd.read_csv(\"../input/wine-reviews/winemag-data-130k-v2.csv\", index_col=0)\n", "#pd.set_option(\"display.max_rows\", 5)\n", "\n", "from learntools.core import binder; binder.bind(globals())\n", "from learntools.pandas.grouping_and_sorting import *\n", "print(\"Setup complete.\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | country | \n", "description | \n", "designation | \n", "points | \n", "price | \n", "province | \n", "region_1 | \n", "region_2 | \n", "taster_name | \n", "taster_twitter_handle | \n", "title | \n", "variety | \n", "winery | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "Italy | \n", "Aromas include tropical fruit, broom, brimston... | \n", "Vulkà Bianco | \n", "87 | \n", "NaN | \n", "Sicily & Sardinia | \n", "Etna | \n", "NaN | \n", "Kerin O’Keefe | \n", "@kerinokeefe | \n", "Nicosia 2013 Vulkà Bianco (Etna) | \n", "White Blend | \n", "Nicosia | \n", "
1 | \n", "Portugal | \n", "This is ripe and fruity, a wine that is smooth... | \n", "Avidagos | \n", "87 | \n", "15.0 | \n", "Douro | \n", "NaN | \n", "NaN | \n", "Roger Voss | \n", "@vossroger | \n", "Quinta dos Avidagos 2011 Avidagos Red (Douro) | \n", "Portuguese Red | \n", "Quinta dos Avidagos | \n", "
2 | \n", "US | \n", "Tart and snappy, the flavors of lime flesh and... | \n", "NaN | \n", "87 | \n", "14.0 | \n", "Oregon | \n", "Willamette Valley | \n", "Willamette Valley | \n", "Paul Gregutt | \n", "@paulgwine | \n", "Rainstorm 2013 Pinot Gris (Willamette Valley) | \n", "Pinot Gris | \n", "Rainstorm | \n", "
3 | \n", "US | \n", "Pineapple rind, lemon pith and orange blossom ... | \n", "Reserve Late Harvest | \n", "87 | \n", "13.0 | \n", "Michigan | \n", "Lake Michigan Shore | \n", "NaN | \n", "Alexander Peartree | \n", "NaN | \n", "St. Julian 2013 Reserve Late Harvest Riesling ... | \n", "Riesling | \n", "St. Julian | \n", "
4 | \n", "US | \n", "Much like the regular bottling from 2012, this... | \n", "Vintner's Reserve Wild Child Block | \n", "87 | \n", "65.0 | \n", "Oregon | \n", "Willamette Valley | \n", "Willamette Valley | \n", "Paul Gregutt | \n", "@paulgwine | \n", "Sweet Cheeks 2012 Vintner's Reserve Wild Child... | \n", "Pinot Noir | \n", "Sweet Cheeks | \n", "