{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Manipulating data frames and wrangling data\n",
"\n",
"
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We have already seen how to perform calculations with data frames by:\n",
"\n",
"- Adding a column, computed from other columns if desired.\n",
"- Computing aggregations.\n",
"- Using window functions\n",
"\n",
"These methods are useful for wrangling data frames, doing things like unit conversions or computing statistical point estimates. There are plenty of other methods you can find in the [Polars documentation](https://docs.pola.rs). The Polars docs, and questions on [Stack Overflow](https://stackoverflow.com) are among your best references for usage."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## What's to come\n",
"\n",
"In the next sections of this lesson, we discuss how to reshape and combine data frames. In these operations, we are not really doing calculations with data, but rather are working to organize our data set into an easily usable, tidy form. We will cover\n",
"\n",
"- Creating a data frame from scratch (as opposed to reading in data from a file)\n",
"- Joining and concatenating data frames (putting two or more data frames together into one)\n",
"- Reshaping data frames by unpivoting and pivoting.\n",
"\n",
"All of these methods are useful to bring inputted data into formats that are convenient to work with."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Polars documentation\n",
"\n",
"The Pandas documentation is a great resource for learning about these methods. In particular, the [section of the user guide on joining concatenating, unpivoting, and pivoting](https://docs.pola.rs/user-guide/transformations/) is very useful. They use very small, contrived data frames to demonstrate the concepts. There are benefits to this approach, certainly, but I find it is often easier to grasp the concepts with real examples. In the following sections of this lesson, we will approach these topics with real examples. You can think of the these lessons as valuable introductions and supplements to the official Polars documentation."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}