@@ -1647,14 +1647,6 @@ english_lang.assign(
1647
1647
)
1648
1648
```
1649
1649
1650
- ``` {note}
1651
- Inserting data manually in this is generally very error-prone and is not recommended.
1652
- We do it here to demonstrate another usage of `assign` that does not involve `apply`.
1653
- But in more advanced data wrangling,
1654
- one would solve this problem in a less error-prone way using
1655
- the `merge` function, which lets you combine two data frames. We will show you an
1656
- example using `merge` at the end of the chapter!
1657
- ```
1658
1650
Instead of using the ` assign ` method we can directly modify the ` english_lang ` data frame using regular column assignment.
1659
1651
This would be a more natural choice in this particular case,
1660
1652
since the syntax is more convenient for simple column modifications and additions.
@@ -1692,6 +1684,15 @@ For the rest of the book, we will silence that warning to help with readability.
1692
1684
pd.options.mode.chained_assignment = None
1693
1685
```
1694
1686
1687
+ ``` {note}
1688
+ Inserting the data column `[4098927, 5928040, ...]` manually as we did above is generally very error-prone and is not recommended.
1689
+ We do it here to demonstrate another usage of `assign` and regular column assignment.
1690
+ But in more advanced data wrangling,
1691
+ one would solve this problem in a less error-prone way using
1692
+ the `merge` function, which lets you combine two data frames. We will show you an
1693
+ example using `merge` at the end of the chapter!
1694
+ ```
1695
+
1695
1696
Now we have a new column with the population for each city. Finally, we calculate the
1696
1697
proportion of people who speak English the most at home by taking the ratio of the columns
1697
1698
` most_at_home ` and ` city_pops ` . Let's modify the ` most_at_home ` column directly; in this case
0 commit comments