Skip to content

Commit 161289d

Browse files
committed
deploy: 51674d6
1 parent 2816676 commit 161289d

File tree

8 files changed

+531
-311
lines changed

8 files changed

+531
-311
lines changed

_sources/docs/pandas/03_Pandas_subsets.ipynb

Lines changed: 186 additions & 112 deletions
Large diffs are not rendered by default.

_sources/docs/pandas/03_pandas_subsets.ipynb

Lines changed: 186 additions & 112 deletions
Large diffs are not rendered by default.

_to_be_deleted_later/notebooks.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ <h2>Code blocks and outputs<a class="headerlink" href="#code-blocks-and-outputs"
478478
</div>
479479
</div>
480480
<div class="cell_output docutils container">
481-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;contextlib.ExitStack at 0x7fadd88b0350&gt;
481+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;contextlib.ExitStack at 0x7f1630b2f6e0&gt;
482482
</pre></div>
483483
</div>
484484
</div>

docs/_test/vega.html

Lines changed: 78 additions & 78 deletions
Large diffs are not rendered by default.

docs/pandas/03_Pandas_subsets.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ <h2> Contents </h2>
425425
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#combining-loc-and-iloc">Combining <code class="docutils literal notranslate"><span class="pre">loc</span></code> and <code class="docutils literal notranslate"><span class="pre">iloc</span></code></a></li>
426426
</ul>
427427
</li>
428+
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#exercise"><i class="fa-solid fa-pencil"></i> Exercise</a></li>
428429
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#key-points">Key points</a></li>
429430
</ul>
430431
</nav>
@@ -2287,6 +2288,40 @@ <h3>Combining <code class="docutils literal notranslate"><span class="pre">loc</
22872288
</div>
22882289
</section>
22892290
</section>
2291+
<section id="exercise">
2292+
<h2><i class="fa-solid fa-pencil"></i> Exercise<a class="headerlink" href="#exercise" title="Link to this heading">#</a></h2>
2293+
<ol class="arabic simple">
2294+
<li><p>What is the number of matching records from:</p></li>
2295+
</ol>
2296+
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">titanic</span><span class="o">.</span><span class="n">iloc</span><span class="p">[:</span><span class="mi">100</span><span class="p">]</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">titanic</span><span class="p">[</span><span class="s1">&#39;Age&#39;</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mi">35</span><span class="p">]</span>
2297+
</pre></div>
2298+
</div>
2299+
<ol class="arabic simple" start="2">
2300+
<li><p>What is the number of matching records from:</p></li>
2301+
</ol>
2302+
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">titanic</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">titanic</span><span class="p">[</span><span class="s1">&#39;Age&#39;</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mi">35</span><span class="p">]</span><span class="o">.</span><span class="n">iloc</span><span class="p">[:</span><span class="mi">100</span><span class="p">]</span>
2303+
</pre></div>
2304+
</div>
2305+
<ol class="arabic simple" start="3">
2306+
<li><p>Reflect on and explain why the two statements return a different number of rows?</p></li>
2307+
</ol>
2308+
<div class="dropdown admonition">
2309+
<p class="admonition-title">Solution</p>
2310+
<p>(We can use the <code class="docutils literal notranslate"><span class="pre">len()</span></code> function to solve question 1 and 2.)</p>
2311+
<ol class="arabic simple">
2312+
<li><p>17 rows</p></li>
2313+
<li><p>100 rows</p></li>
2314+
<li><p>The two expressions differ in the <strong>order</strong> of filtering and slicing, which affects the final result:</p></li>
2315+
</ol>
2316+
<ul class="simple">
2317+
<li><p><code class="docutils literal notranslate"><span class="pre">titanic.iloc[:100].loc[titanic['Age']</span> <span class="pre">&gt;</span> <span class="pre">35]</span></code><br />
2318+
→ First selects the <strong>first 100 rows</strong>, then filters for rows where <code class="docutils literal notranslate"><span class="pre">Age</span> <span class="pre">&gt;</span> <span class="pre">35</span></code> <strong>within those 100</strong>.</p></li>
2319+
<li><p><code class="docutils literal notranslate"><span class="pre">titanic.loc[titanic['Age']</span> <span class="pre">&gt;</span> <span class="pre">35].iloc[:100]</span></code><br />
2320+
→ First filters for <strong>all rows</strong> where <code class="docutils literal notranslate"><span class="pre">Age</span> <span class="pre">&gt;</span> <span class="pre">35</span></code>, then selects the <strong>first 100 rows</strong> from that filtered set.</p></li>
2321+
</ul>
2322+
<p>Thus, the main difference lies in <strong>whether you slice first or filter first</strong>, which can lead to <strong>very different subsets of data</strong>.</p>
2323+
</div>
2324+
</section>
22902325
<hr class="docutils" />
22912326
<section id="key-points">
22922327
<h2>Key points<a class="headerlink" href="#key-points" title="Link to this heading">#</a></h2>
@@ -2385,6 +2420,7 @@ <h2>Key points<a class="headerlink" href="#key-points" title="Link to this headi
23852420
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#combining-loc-and-iloc">Combining <code class="docutils literal notranslate"><span class="pre">loc</span></code> and <code class="docutils literal notranslate"><span class="pre">iloc</span></code></a></li>
23862421
</ul>
23872422
</li>
2423+
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#exercise"><i class="fa-solid fa-pencil"></i> Exercise</a></li>
23882424
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#key-points">Key points</a></li>
23892425
</ul>
23902426
</nav></div>

docs/pandas/03_pandas_subsets.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ <h2> Contents </h2>
444444
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#combining-loc-and-iloc">Combining <code class="docutils literal notranslate"><span class="pre">loc</span></code> and <code class="docutils literal notranslate"><span class="pre">iloc</span></code></a></li>
445445
</ul>
446446
</li>
447+
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#exercise"><i class="fa-solid fa-pencil"></i> Exercise</a></li>
447448
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#key-points">Key points</a></li>
448449
</ul>
449450
</nav>
@@ -2306,6 +2307,40 @@ <h3>Combining <code class="docutils literal notranslate"><span class="pre">loc</
23062307
</div>
23072308
</section>
23082309
</section>
2310+
<section id="exercise">
2311+
<h2><i class="fa-solid fa-pencil"></i> Exercise<a class="headerlink" href="#exercise" title="Link to this heading">#</a></h2>
2312+
<ol class="arabic simple">
2313+
<li><p>What is the number of matching records from:</p></li>
2314+
</ol>
2315+
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">titanic</span><span class="o">.</span><span class="n">iloc</span><span class="p">[:</span><span class="mi">100</span><span class="p">]</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">titanic</span><span class="p">[</span><span class="s1">&#39;Age&#39;</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mi">35</span><span class="p">]</span>
2316+
</pre></div>
2317+
</div>
2318+
<ol class="arabic simple" start="2">
2319+
<li><p>What is the number of matching records from:</p></li>
2320+
</ol>
2321+
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">titanic</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">titanic</span><span class="p">[</span><span class="s1">&#39;Age&#39;</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mi">35</span><span class="p">]</span><span class="o">.</span><span class="n">iloc</span><span class="p">[:</span><span class="mi">100</span><span class="p">]</span>
2322+
</pre></div>
2323+
</div>
2324+
<ol class="arabic simple" start="3">
2325+
<li><p>Reflect on and explain why the two statements return a different number of rows?</p></li>
2326+
</ol>
2327+
<div class="dropdown admonition">
2328+
<p class="admonition-title">Solution</p>
2329+
<p>(We can use the <code class="docutils literal notranslate"><span class="pre">len()</span></code> function to solve question 1 and 2.)</p>
2330+
<ol class="arabic simple">
2331+
<li><p>17 rows</p></li>
2332+
<li><p>100 rows</p></li>
2333+
<li><p>The two expressions differ in the <strong>order</strong> of filtering and slicing, which affects the final result:</p></li>
2334+
</ol>
2335+
<ul class="simple">
2336+
<li><p><code class="docutils literal notranslate"><span class="pre">titanic.iloc[:100].loc[titanic['Age']</span> <span class="pre">&gt;</span> <span class="pre">35]</span></code><br />
2337+
→ First selects the <strong>first 100 rows</strong>, then filters for rows where <code class="docutils literal notranslate"><span class="pre">Age</span> <span class="pre">&gt;</span> <span class="pre">35</span></code> <strong>within those 100</strong>.</p></li>
2338+
<li><p><code class="docutils literal notranslate"><span class="pre">titanic.loc[titanic['Age']</span> <span class="pre">&gt;</span> <span class="pre">35].iloc[:100]</span></code><br />
2339+
→ First filters for <strong>all rows</strong> where <code class="docutils literal notranslate"><span class="pre">Age</span> <span class="pre">&gt;</span> <span class="pre">35</span></code>, then selects the <strong>first 100 rows</strong> from that filtered set.</p></li>
2340+
</ul>
2341+
<p>Thus, the main difference lies in <strong>whether you slice first or filter first</strong>, which can lead to <strong>very different subsets of data</strong>.</p>
2342+
</div>
2343+
</section>
23092344
<hr class="docutils" />
23102345
<section id="key-points">
23112346
<h2>Key points<a class="headerlink" href="#key-points" title="Link to this heading">#</a></h2>
@@ -2403,6 +2438,7 @@ <h2>Key points<a class="headerlink" href="#key-points" title="Link to this headi
24032438
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#combining-loc-and-iloc">Combining <code class="docutils literal notranslate"><span class="pre">loc</span></code> and <code class="docutils literal notranslate"><span class="pre">iloc</span></code></a></li>
24042439
</ul>
24052440
</li>
2441+
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#exercise"><i class="fa-solid fa-pencil"></i> Exercise</a></li>
24062442
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#key-points">Key points</a></li>
24072443
</ul>
24082444
</nav></div>

docs/tutorials/matplotlib.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ <h3>The explicit and the implicit interfaces<a class="headerlink" href="#the-exp
642642
</div>
643643
</div>
644644
<div class="cell_output docutils container">
645-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7faeac4b1130&gt;
645+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f69b3e66d20&gt;
646646
</pre></div>
647647
</div>
648648
<img alt="../../_images/92f2340808d1a3d864541dcd2b5dba860466e6885085bd91e396de315b698b88.png" src="../../_images/92f2340808d1a3d864541dcd2b5dba860466e6885085bd91e396de315b698b88.png" />
@@ -665,7 +665,7 @@ <h3>The explicit and the implicit interfaces<a class="headerlink" href="#the-exp
665665
</div>
666666
</div>
667667
<div class="cell_output docutils container">
668-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7faeae829f70&gt;
668+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f69b3f23c80&gt;
669669
</pre></div>
670670
</div>
671671
<img alt="../../_images/92f2340808d1a3d864541dcd2b5dba860466e6885085bd91e396de315b698b88.png" src="../../_images/92f2340808d1a3d864541dcd2b5dba860466e6885085bd91e396de315b698b88.png" />
@@ -714,7 +714,7 @@ <h3>Making a helper functions<a class="headerlink" href="#making-a-helper-functi
714714
</div>
715715
</div>
716716
<div class="cell_output docutils container">
717-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;matplotlib.lines.Line2D at 0x7faeac409bb0&gt;]
717+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;matplotlib.lines.Line2D at 0x7f69b1db5be0&gt;]
718718
</pre></div>
719719
</div>
720720
<img alt="../../_images/be4b8c194bd74be420b45b4766c2bd2684124e5955e30308b1a60c6d70642526.png" src="../../_images/be4b8c194bd74be420b45b4766c2bd2684124e5955e30308b1a60c6d70642526.png" />
@@ -761,7 +761,7 @@ <h3>Colors<a class="headerlink" href="#colors" title="Link to this heading">#</a
761761
</div>
762762
</div>
763763
<div class="cell_output docutils container">
764-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.collections.PathCollection at 0x7faeac2ca510&gt;
764+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.collections.PathCollection at 0x7f69b1c59b50&gt;
765765
</pre></div>
766766
</div>
767767
<img alt="../../_images/67108aa388b3ef345c342273e2d62593fad03232eeb46126dccf88e13dec7ca9.png" src="../../_images/67108aa388b3ef345c342273e2d62593fad03232eeb46126dccf88e13dec7ca9.png" />
@@ -791,7 +791,7 @@ <h3>Linewidths, linestyles, and markersizes<a class="headerlink" href="#linewidt
791791
</div>
792792
</div>
793793
<div class="cell_output docutils container">
794-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7faeac3baea0&gt;
794+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f69b1c727b0&gt;
795795
</pre></div>
796796
</div>
797797
<img alt="../../_images/30f81b0ffd312efc74103619e61c19e9543a242ae31f4da134797bd1fe7ca5b0.png" src="../../_images/30f81b0ffd312efc74103619e61c19e9543a242ae31f4da134797bd1fe7ca5b0.png" />
@@ -898,7 +898,7 @@ <h3>Legends<a class="headerlink" href="#legends" title="Link to this heading">#<
898898
</div>
899899
</div>
900900
<div class="cell_output docutils container">
901-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7faeac12dc10&gt;
901+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f69b1c72de0&gt;
902902
</pre></div>
903903
</div>
904904
<img alt="../../_images/e09ad3a7555c7fe744c15dd77c0217a5385b2ac7385278207b148323375e709c.png" src="../../_images/e09ad3a7555c7fe744c15dd77c0217a5385b2ac7385278207b148323375e709c.png" />
@@ -936,7 +936,7 @@ <h3>Scales<a class="headerlink" href="#scales" title="Link to this heading">#</a
936936
</div>
937937
</div>
938938
<div class="cell_output docutils container">
939-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;matplotlib.lines.Line2D at 0x7faeac02da30&gt;]
939+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;matplotlib.lines.Line2D at 0x7f69b19c9a60&gt;]
940940
</pre></div>
941941
</div>
942942
<img alt="../../_images/9b867617227a1c1ff48ff943888393786e48420237e271ae4220f24a2e3bac85.png" src="../../_images/9b867617227a1c1ff48ff943888393786e48420237e271ae4220f24a2e3bac85.png" />

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)