Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for cudf_pandas_opencellid_demo.ipynb #39

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions getting_started_tutorials/cudf_pandas_opencellid_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"outputs": [],
"source": [
"# Install required packages\n",
"! pip install -q hvplot pydeck panel holoviews=1.18.3"
"! pip install -q hvplot pydeck panel holoviews==1.18.3"
raybellwaves marked this conversation as resolved.
Show resolved Hide resolved
]
},
{
Expand Down Expand Up @@ -100,8 +100,23 @@
"metadata": {},
"outputs": [],
"source": [
"# For Google Colab, download the script from a GitHub repository by uncommenting the line below\n",
"# !wget https://raw.githubusercontent.com/rapidsai-community/showcase/main/getting_started_tutorials/opencellid_downloader.py"
"import os\n",
"import subprocess\n",
"\n",
"file_name = \"opencellid_downloader.py\"\n",
"file_url = f\"https://raw.githubusercontent.com/rapidsai-community/showcase/main/getting_started_tutorials/{file_name}\"\n",
"\n",
"if os.path.exists(file_name):\n",
" print(f\"The file '{file_name}' exists in the current directory.\")\n",
"else:\n",
" print(f\"The file '{file_name}' does not exist in the current directory. Downloading it now...\")\n",
" try:\n",
" subprocess.run([\"wget\", file_url], check=True)\n",
" print(f\"Successfully downloaded '{file_name}'.\")\n",
" except subprocess.CalledProcessError as e:\n",
" print(f\"Failed to download the file. Error: {e}\")\n",
" except FileNotFoundError:\n",
" print(\"The 'wget' command is not found. Please ensure it's installed and in your system PATH.\")"
Comment on lines +103 to +119
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of checking if the file exists before downloading, can be done in an inline way as well to keep the cell size small:

!test -f opencellid_downloader.py || wget https://raw.githubusercontent.com/rapidsai-community/showcase/main/getting_started_tutorials/opencellid_downloader.py

]
},
{
Expand Down