Skip to content

Commit f66547b

Browse files
minor wordsmith on note; moving a bit later
1 parent 26123e9 commit f66547b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

source/wrangling.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,14 +1647,6 @@ english_lang.assign(
16471647
)
16481648
```
16491649

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-
```
16581650
Instead of using the `assign` method we can directly modify the `english_lang` data frame using regular column assignment.
16591651
This would be a more natural choice in this particular case,
16601652
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.
16921684
pd.options.mode.chained_assignment = None
16931685
```
16941686

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+
16951696
Now we have a new column with the population for each city. Finally, we calculate the
16961697
proportion of people who speak English the most at home by taking the ratio of the columns
16971698
`most_at_home` and `city_pops`. Let's modify the `most_at_home` column directly; in this case

0 commit comments

Comments
 (0)