You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 977a9fe
Browse filesBrowse the repository at this point in the historyBrowse files
[pandas_panel] Take programming's text, so both series publish one lecture (#1088)
* [pandas_panel] Take programming's text, so both series publish one lecture
Programming and intermediate both publish pandas_panel. The two copies
were the same lecture drifting apart: programming's carries the pandas
3.0 update and later tidy-ups that never reached this copy. John and
Matt decided on 2026-10-12 to publish one text (project-monorepo#110),
so this copy becomes programming's, byte for byte.
Programming's text links to its pandas lecture with {doc}`pandas`,
which this site does not have. intersphinx_disabled_reftypes: [] lets
a reference with no local target resolve through intersphinx, here to
python-programming.quantecon.org. Every other reference in this series
already resolves locally (the build runs -n -W), so nothing else moves.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* [pandas_panel] Describe the single .replace() call, not a loop
The sentence above the continent recoding still said we "loop through a
list", but the code makes one .replace() call with the whole list. Say
what the code does, and end the sentence with a full stop.
Programming takes the identical change, so the two copies stay
byte-identical.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
# {index}`Pandas for Panel Data <single: Pandas for Panel Data>`
24
24
25
25
```{index} single: Python; Pandas
26
26
```
27
27
28
-
```{contents} Contents
29
-
:depth: 2
28
+
In addition to what’s in Anaconda, this lecture will need the following libraries:
29
+
30
+
```{code-cell} ipython3
31
+
:tags: [hide-output]
32
+
33
+
!pip install --upgrade seaborn
34
+
```
35
+
36
+
We use the following imports.
37
+
38
+
```{code-cell} ipython3
39
+
import matplotlib.pyplot as plt
40
+
import seaborn as sns
41
+
sns.set_theme()
30
42
```
31
43
32
44
## Overview
33
45
34
-
In an [earlier lecture on pandas](https://python-programming.quantecon.org/pandas.html), we looked at working with simple data sets.
46
+
In an {doc}`earlier lecture on pandas <pandas>`, we looked at working with simple data sets.
35
47
36
48
Econometricians often need to work with more complex data sets, such as panels.
37
49
@@ -65,7 +77,7 @@ countries and assign it to `realwage`.
65
77
The dataset can be accessed with the following link:
We can also specify a level of the `MultiIndex` (in the column axis)
400
-
to aggregate over
402
+
to aggregate over.
403
+
404
+
In the case of `groupby`, we need to use `.T` to transpose the columns into rows, as `pandas` has removed support for `axis=1` in the `groupby` method.
We can plot the average minimum wages in each continent as a time series
@@ -428,7 +432,7 @@ plt.show()
428
432
summary statistics
429
433
430
434
```{code-cell} ipython3
431
-
merged.stack(future_stack=True).describe()
435
+
merged.stack().describe()
432
436
```
433
437
434
438
This is a simplified way to use `groupby`.
@@ -502,7 +506,7 @@ in Europe by age and sex from [Eurostat](https://ec.europa.eu/eurostat/data/data
502
506
The dataset can be accessed with the following link:
0 commit comments