Skip to content

Commit 5365616

Browse files
wrangling pdf fixes
1 parent 9e68db3 commit 5365616

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

source/wrangling.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,8 +1490,9 @@ in our case, we get an error.
14901490
region_lang["most_at_home":"lang_known"].groupby("region").max()
14911491
```
14921492

1493-
```
1494-
KeyError: "region"
1493+
```{code-cell} ipython3
1494+
:tags: ["remove-input"]
1495+
print('KeyError: "region"')
14951496
```
14961497

14971498
This is because when we use `[]` we selected only the columns between
@@ -1727,23 +1728,20 @@ Instead of using the `assign` method we can directly modify the `english_lang` d
17271728
This would be a more natural choice in this particular case,
17281729
since the syntax is more convenient for simple column modifications and additions.
17291730
```{code-cell} ipython3
1730-
:tags: [remove-cell]
1731-
english_lang["city_pops"] = [4098927, 5928040, 1392609, 1321426, 2463431]
1732-
```
1733-
```python
1731+
:tags: [remove-output]
17341732
english_lang["city_pops"] = [4098927, 5928040, 1392609, 1321426, 2463431]
17351733
english_lang
17361734
```
1737-
```text
1735+
```{code-cell} ipython3
1736+
:tags: ["remove-input"]
1737+
print("""
17381738
/tmp/ipykernel_12/2654974267.py:1: SettingWithCopyWarning:
17391739
A value is trying to be set on a copy of a slice from a DataFrame.
17401740
Try using .loc[row_indexer,col_indexer] = value instead
17411741
17421742
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
17431743
english_lang["city_pops"] = [4098927, 5928040, 1392609, 1321426, 2463431]
1744-
```
1745-
```{code-cell} ipython3
1746-
:tags: [remove-input]
1744+
""")
17471745
english_lang
17481746
```
17491747

0 commit comments

Comments
 (0)