Skip to content

Commit

Permalink
deploy: 08cb431
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorcampbell committed Dec 28, 2023
1 parent dc714a9 commit 7dc2f5d
Show file tree
Hide file tree
Showing 11 changed files with 760 additions and 754 deletions.
18 changes: 8 additions & 10 deletions pull341/_sources/wrangling.md
Original file line number Diff line number Diff line change
Expand Up @@ -1490,8 +1490,9 @@ in our case, we get an error.
region_lang["most_at_home":"lang_known"].groupby("region").max()
```

```
KeyError: "region"
```{code-cell} ipython3
:tags: ["remove-input"]
print('KeyError: "region"')
```

This is because when we use `[]` we selected only the columns between
Expand Down Expand Up @@ -1727,23 +1728,20 @@ Instead of using the `assign` method we can directly modify the `english_lang` d
This would be a more natural choice in this particular case,
since the syntax is more convenient for simple column modifications and additions.
```{code-cell} ipython3
:tags: [remove-cell]
english_lang["city_pops"] = [4098927, 5928040, 1392609, 1321426, 2463431]
```
```python
:tags: [remove-output]
english_lang["city_pops"] = [4098927, 5928040, 1392609, 1321426, 2463431]
english_lang
```
```text
```{code-cell} ipython3
:tags: ["remove-input"]
print("""
/tmp/ipykernel_12/2654974267.py:1: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
english_lang["city_pops"] = [4098927, 5928040, 1392609, 1321426, 2463431]
```
```{code-cell} ipython3
:tags: [remove-input]
""")
english_lang
```

Expand Down
204 changes: 102 additions & 102 deletions pull341/classification1.html

Large diffs are not rendered by default.

156 changes: 78 additions & 78 deletions pull341/classification2.html

Large diffs are not rendered by default.

182 changes: 91 additions & 91 deletions pull341/clustering.html

Large diffs are not rendered by default.

182 changes: 91 additions & 91 deletions pull341/inference.html

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions pull341/intro.html

Large diffs are not rendered by default.

130 changes: 65 additions & 65 deletions pull341/regression1.html

Large diffs are not rendered by default.

158 changes: 79 additions & 79 deletions pull341/regression2.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pull341/searchindex.js

Large diffs are not rendered by default.

392 changes: 196 additions & 196 deletions pull341/viz.html

Large diffs are not rendered by default.

20 changes: 14 additions & 6 deletions pull341/wrangling.html
Original file line number Diff line number Diff line change
Expand Up @@ -4792,7 +4792,7 @@ <h2><span class="section-number">3.9. </span>Performing operations on groups of
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;pandas.core.groupby.generic.DataFrameGroupBy object at 0x7efc8fc96a90&gt;
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;pandas.core.groupby.generic.DataFrameGroupBy object at 0x7f4e47548a90&gt;
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -5372,9 +5372,13 @@ <h2><span class="section-number">3.9. </span>Performing operations on groups of
</div>
</div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="ne">KeyError</span><span class="p">:</span> <span class="s2">&quot;region&quot;</span>
<div class="cell tag_remove-input docutils container">
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>KeyError: &quot;region&quot;
</pre></div>
</div>
</div>
</div>
<p>This is because when we use <code class="docutils literal notranslate"><span class="pre">[]</span></code> we selected only the columns between
<code class="docutils literal notranslate"><span class="pre">&quot;most_at_home&quot;</span></code> and <code class="docutils literal notranslate"><span class="pre">&quot;lang_known&quot;</span></code>, which doesn’t include <code class="docutils literal notranslate"><span class="pre">&quot;region&quot;</span></code>!
Instead, we need to use <code class="docutils literal notranslate"><span class="pre">groupby</span></code> first
Expand Down Expand Up @@ -6450,20 +6454,24 @@ <h2><span class="section-number">3.10. </span>Apply functions across multiple co
<p>Instead of using the <code class="docutils literal notranslate"><span class="pre">assign</span></code> method we can directly modify the <code class="docutils literal notranslate"><span class="pre">english_lang</span></code> data frame using regular column assignment.
This would be a more natural choice in this particular case,
since the syntax is more convenient for simple column modifications and additions.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">english_lang</span><span class="p">[</span><span class="s2">&quot;city_pops&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mi">4098927</span><span class="p">,</span> <span class="mi">5928040</span><span class="p">,</span> <span class="mi">1392609</span><span class="p">,</span> <span class="mi">1321426</span><span class="p">,</span> <span class="mi">2463431</span><span class="p">]</span>
<div class="cell tag_remove-output docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">english_lang</span><span class="p">[</span><span class="s2">&quot;city_pops&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mi">4098927</span><span class="p">,</span> <span class="mi">5928040</span><span class="p">,</span> <span class="mi">1392609</span><span class="p">,</span> <span class="mi">1321426</span><span class="p">,</span> <span class="mi">2463431</span><span class="p">]</span>
<span class="n">english_lang</span>
</pre></div>
</div>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>/tmp/ipykernel_12/2654974267.py:1: SettingWithCopyWarning:
</div>
</div>
<div class="cell tag_remove-input docutils container">
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/tmp/ipykernel_12/2654974267.py:1: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
english_lang[&quot;city_pops&quot;] = [4098927, 5928040, 1392609, 1321426, 2463431]
</pre></div>
</div>
<div class="cell tag_remove-input docutils container">
<div class="cell_output docutils container">
<div class="output text_html"><div>
<style scoped>
.dataframe tbody tr th:only-of-type {
Expand Down

0 comments on commit 7dc2f5d

Please sign in to comment.