a post with jupyter notebook

To include a jupyter notebook in a post, you can use the following code:

1
2
3
4
5
6
7
8
9
{::nomarkdown}
{% assign jupyter_path = 'assets/jupyter/eda-on-us-road-accident-2016-2023.ipynb' | relative_url %}
{% capture notebook_exists %}{% file_exists assets/jupyter/eda-on-us-road-accident-2016-2023.ipynb %}{% endcapture %}
{% if notebook_exists == 'true' %}
  {% jupyter_notebook jupyter_path %}
{% else %}
  <p>Sorry, the notebook you are looking for does not exist.</p>
{% endif %}
{:/nomarkdown}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{::nomarkdown}



<div
  class="jupyter-notebook"
  style="position: relative; width: 100%; margin: 0 auto;">
  <div class="jupyter-notebook-iframe-container">
    <iframe
      src="/assets/jupyter/eda-on-us-road-accident-2016-2023.ipynb.html"
      style="position: absolute; top: 0; left: 0; border-style: none;"
      width="100%"
      height="100%"
      onload="this.parentElement.style.paddingBottom = (this.contentWindow.document.documentElement.scrollHeight + 10) + 'px'"></iframe>
  </div>
</div>


{:/nomarkdown}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{::nomarkdown}



<div
  class="jupyter-notebook"
  style="position: relative; width: 100%; margin: 0 auto;">
  <div class="jupyter-notebook-iframe-container">
    <iframe
      src="/assets/jupyter/eda-on-us-road-accident-2016-2023.ipynb.html"
      style="position: absolute; top: 0; left: 0; border-style: none;"
      width="100%"
      height="100%"
      onload="this.parentElement.style.paddingBottom = (this.contentWindow.document.documentElement.scrollHeight + 10) + 'px'"></iframe>
  </div>
</div>


{:/nomarkdown}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{::nomarkdown}



<div
  class="jupyter-notebook"
  style="position: relative; width: 100%; margin: 0 auto;">
  <div class="jupyter-notebook-iframe-container">
    <iframe
      src="/assets/jupyter/eda-on-us-road-accident-2016-2023.ipynb.html"
      style="position: absolute; top: 0; left: 0; border-style: none;"
      width="100%"
      height="100%"
      onload="this.parentElement.style.paddingBottom = (this.contentWindow.document.documentElement.scrollHeight + 10) + 'px'"></iframe>
  </div>
</div>


{:/nomarkdown}