Skip to content

Commit

Permalink
fixing some lectures
Browse files Browse the repository at this point in the history
  • Loading branch information
danilofreire committed Sep 3, 2024
1 parent 22672a1 commit 2f320be
Show file tree
Hide file tree
Showing 122 changed files with 610 additions and 3,429 deletions.
425 changes: 348 additions & 77 deletions docs/lectures/lectures.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/search.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/syllabus.html
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ <h2 class="anchored" data-anchor-id="module-02-introduction-to-the-command-line-
<section id="monday-september-09" class="level3">
<h3 class="anchored" data-anchor-id="monday-september-09">Monday September 09:</h3>
<ul>
<li>Lecture 03: The command line interface (CLI), shell basics, and file management.</li>
<li>Lecture 03: <a href="https://danilofreire.github.io/qtm350/lectures/lecture-03/03-command-line.html">The Command Line Interface (CLI), Shell Basics, and File Management</a>.</li>
</ul>
<p>Suggested references:</p>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/01-vscode-anaconda-tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ <h2 class="anchored" data-anchor-id="select-the-anaconda-python-interpreter">Sel
<ul>
<li>Include the following code in the file:</li>
</ul>
<div id="1a7b2a58" class="cell" data-execution_count="1">
<div id="cedb666e" class="cell" data-execution_count="1">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> sys</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(sys.version)</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(sys.executable)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
Expand Down
14 changes: 7 additions & 7 deletions docs/tutorials/02-jupyter-markdown-tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ <h2 class="anchored" data-anchor-id="creating-a-new-notebook">Creating a New Not
</figure>
</div>
<p>Here you should enter the Python commands. For example, type the following lines of code in the code cell:</p>
<div id="bf17027e" class="cell" data-execution_count="1">
<div id="988659b0" class="cell" data-execution_count="1">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(<span class="st">"Welcome to QTM 350!"</span>)</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>x <span class="op">=</span> <span class="dv">5</span></span>
Expand Down Expand Up @@ -408,7 +408,7 @@ <h3 class="anchored" data-anchor-id="basic-method-using-pandas.dataframe.to_mark
<section id="step-1-import-pandas-and-create-a-dataframe" class="level4">
<h4 class="anchored" data-anchor-id="step-1-import-pandas-and-create-a-dataframe">Step 1: Import pandas and create a DataFrame</h4>
<p>You can create a dataframe by passing a dictionary to the <code>pd.DataFrame()</code> constructor:</p>
<div id="a4ad8781" class="cell" data-execution_count="2">
<div id="720636e4" class="cell" data-execution_count="2">
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co"># If necessary, install pandas and tabulate </span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="co"># You should have pandas installed if you installed Anaconda, </span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="co"># but if you do not, you can install both with the following terminal command:</span></span>
Expand All @@ -430,7 +430,7 @@ <h4 class="anchored" data-anchor-id="step-1-import-pandas-and-create-a-dataframe
<section id="step-2-convert-dataframe-to-markdown" class="level4">
<h4 class="anchored" data-anchor-id="step-2-convert-dataframe-to-markdown">Step 2: Convert DataFrame to Markdown</h4>
<p>Then you just need to call the <code>to_markdown()</code> method on the DataFrame:</p>
<div id="d5541f01" class="cell" data-execution_count="3">
<div id="eddcf24b" class="cell" data-execution_count="3">
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Print the DataFrame as a Markdown table, excluding the index</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a>markdown_table <span class="op">=</span> df.to_markdown(index<span class="op">=</span><span class="va">False</span>)</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(markdown_table)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
Expand All @@ -445,7 +445,7 @@ <h4 class="anchored" data-anchor-id="step-2-convert-dataframe-to-markdown">Step
<section id="step-3-display-in-jupyter-notebook" class="level4">
<h4 class="anchored" data-anchor-id="step-3-display-in-jupyter-notebook">Step 3: Display in Jupyter Notebook</h4>
<p>To display the Markdown table in a Jupyter Notebook cell, use the <code>display()</code> function from the <code>IPython.display</code> module:</p>
<div id="37d6b156" class="cell" data-execution_count="4">
<div id="61e1f7b9" class="cell" data-execution_count="4">
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="co"># You should also have the IPython package installed if you installed Anaconda</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="co"># If not, you can install it with</span></span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="co"># conda install ipython</span></span>
Expand All @@ -469,7 +469,7 @@ <h4 class="anchored" data-anchor-id="step-3-display-in-jupyter-notebook">Step 3:
<section id="advanced-formatting" class="level3">
<h3 class="anchored" data-anchor-id="advanced-formatting">Advanced Formatting</h3>
<p>You can customise the Markdown table using various parameters of <code>to_markdown()</code>:</p>
<div id="fda6717e" class="cell" data-execution_count="5">
<div id="96e14f6f" class="cell" data-execution_count="5">
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Customising the Markdown table using the to_markdown() method</span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a>markdown_table <span class="op">=</span> df.to_markdown(</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> index<span class="op">=</span><span class="va">False</span>, <span class="co"># Don't include index</span></span>
Expand All @@ -484,7 +484,7 @@ <h3 class="anchored" data-anchor-id="advanced-formatting">Advanced Formatting</h
<section id="using-tabulate-for-enhanced-formatting" class="level3">
<h3 class="anchored" data-anchor-id="using-tabulate-for-enhanced-formatting">Using tabulate for Enhanced Formatting</h3>
<p>The <code>tabulate</code> library offers even more formatting options. While they are not necessary for basic tables, they can be useful for more complex tables. In our course, you will probably not need them, but I will show you how to use them for your reference. Please check their <a href="https://pypi.org/project/tabulate/">documentation</a> for more information.</p>
<div id="ae054f70" class="cell" data-execution_count="6">
<div id="9f85704c" class="cell" data-execution_count="6">
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="im">from</span> tabulate <span class="im">import</span> tabulate</span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a>markdown_table <span class="op">=</span> tabulate(df, headers<span class="op">=</span><span class="st">'keys'</span>, tablefmt<span class="op">=</span><span class="st">'pipe'</span>, showindex<span class="op">=</span><span class="va">False</span>)</span>
Expand All @@ -504,7 +504,7 @@ <h3 class="anchored" data-anchor-id="best-practices">Best Practices</h3>
<section id="example-comprehensive-table-creation" class="level3">
<h3 class="anchored" data-anchor-id="example-comprehensive-table-creation">Example: Comprehensive Table Creation</h3>
<p>Here is a more comprehensive example incorporating various best practices:</p>
<div id="249c991b" class="cell" data-execution_count="7">
<div id="3ea3cfdd" class="cell" data-execution_count="7">
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Import necessary packages</span></span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> pandas <span class="im">as</span> pd</span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a><span class="im">from</span> IPython.display <span class="im">import</span> display, Markdown</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/python-postgresql-example.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<span class="menu-text">Lectures</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="../tutorials/tutorials.html">
<a class="nav-link" href="../tutorials/tutorials.qmd">
<span class="menu-text">Tutorials</span></a>
</li>
<li class="nav-item">
Expand Down Expand Up @@ -845,7 +845,7 @@ <h1 class="title">PostgreSQL Example</h1>
<footer class="footer">
<div class="nav-footer">
<div class="nav-footer-left">
<p>Copyright 2024, Danilo Freire. The content of this site is licensed under the <a href="../tutorials/LICENSE.html">MIT License</a>.</p>
<p>Copyright 2024, Danilo Freire. The content of this site is licensed under the <a href="LICENSE.qmd">MIT License</a>.</p>
</div>
<div class="nav-footer-center">
&nbsp;
Expand Down
Loading

0 comments on commit 2f320be

Please sign in to comment.