"By the end of this lesson, students will be able to:\n",
"\n",
"- Design spreadsheet data models that enable reproducible data analysis.\n",
"- Convert a pivot table operation to `pandas` `groupby` and vice versa.\n",
"- Write spreadsheet formulas that apply a function over many cells.\n",
"\n",
"For this lesson, we'll spend most of our time in the preceding notebook on [groupby-and-indexing.ipynb](groupby-and-indexing.ipynb).\n",
"\n",
"Later, we'll download the `earthquakes.csv` file and use it to create a spreadsheet. In lecture, we will visit [sheets.new](https://sheets.new) to create a new Google Sheet."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "494a3641",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import seaborn as sns\n",
"\n",
"sns.set_theme()"
]
},
{
"cell_type": "markdown",
"id": "37a0cdc1",
"metadata": {},
"source": [
"### What is pivot table?\n",
"\n",
"Let's first revisit the life expectancy dataset and use this as an example of showing what it is in pandas."
"Let's try pivoting the table about the \"Country\" column. We can read the documentation of `pivot_table` [here](https://pandas.pydata.org/docs/reference/api/pandas.pivot_table.html)."
By the end of this lesson, students will be able to:
- Design spreadsheet data models that enable reproducible data analysis.
- Convert a pivot table operation to `pandas``groupby` and vice versa.
- Write spreadsheet formulas that apply a function over many cells.
For this lesson, we'll spend most of our time in the preceding notebook on [groupby-and-indexing.ipynb](groupby-and-indexing.ipynb).
Later, we'll download the `earthquakes.csv` file and use it to create a spreadsheet. In lecture, we will visit [sheets.new](https://sheets.new) to create a new Google Sheet.
%% Cell type:code id:494a3641 tags:
``` python
importpandasaspd
importseabornassns
sns.set_theme()
```
%% Cell type:markdown id:37a0cdc1 tags:
### What is pivot table?
Let's first revisit the life expectancy dataset and use this as an example of showing what it is in pandas.
Let's try pivoting the table about the "Country" column. We can read the documentation of `pivot_table`[here](https://pandas.pydata.org/docs/reference/api/pandas.pivot_table.html).