File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -1539,15 +1539,15 @@ you can use the more general [`apply`](https://pandas.pydata.org/docs/reference/
1539
1539
When we compute summary statistics or apply functions,
1540
1540
a new data frame or series is created. But what if we want to append that information
1541
1541
to an existing data frame? For example, say we wanted to compute the
1542
- maximum value in each row of the ` region_lang_nums ` data frame using ` apply ` ,
1542
+ maximum value in each row of the ` region_lang_nums ` data frame,
1543
1543
and to append that as an additional column of the ` region_lang ` data frame.
1544
1544
In this case, we have two options: we can either create a new column within the ` region_lang ` data
1545
1545
frame itself, or create an entirely new data frame
1546
1546
with the ` assign ` method. The first option we have seen already in earlier chapters, and is
1547
1547
the more commonly used pattern in practice:
1548
1548
``` {code-cell} ipython3
1549
1549
:tags: ["output_scroll"]
1550
- region_lang["maximum"] = region_lang_nums.apply( max, axis=1)
1550
+ region_lang["maximum"] = region_lang_nums.max( axis=1)
1551
1551
region_lang
1552
1552
```
1553
1553
You can see above that the ` region_lang ` data frame now has an additional column named ` maximum ` .
You can’t perform that action at this time.
0 commit comments