Last active
February 23, 2020 13:44
-
-
Save shandou/8975797deac91401173d40ca9fe4f8c4 to your computer and use it in GitHub Desktop.
For more information about CND-available PrismJS features:1. Basic documentation and plugin utilities: https://prismjs.com/index.html2. CDN css and js: https://cdnjs.com/libraries/prism
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- CSS style sheets for Prism.js --> | |
<link | |
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/themes/prism.min.css" | |
rel="stylesheet" | |
/> | |
<link | |
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/plugins/line-numbers/prism-line-numbers.min.css" | |
rel="stylesheet" | |
/> | |
<!-- Code snippet content --> | |
<pre class="line-numbers"> | |
<code style="font-family: Monaco, sans-serif" class="language-python">import subprocess | |
import pathlib | |
import requests | |
from tqdm import tqdm | |
import pandas as pd | |
# Destination folder for the downloaded files | |
dir_dest = pathlib.Path(__file__).absolute().parent.parent / "dataset" | |
try: | |
# Send GET request to Github API | |
r = requests.get( | |
( | |
"https://api.github.com/repos/shandou/" | |
"data-sets/contents" | |
) | |
) | |
r.raise_for_status() | |
except requests.exceptions.HTTPError as e: | |
print(f"requests failed with error {e}") | |
else: | |
# When requests succeed, pack returned JSON into pandas dataframe | |
df = pd.read_json(r.content) | |
</code> | |
</pre> | |
<!-- Javascript for Prism.js core, line number display, and python syntax highlight --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/prism.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/plugins/line-numbers/prism-line-numbers.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/components/prism-python.min.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment