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

fix cuspatial.haversine_distance() example in multi-tenant notebook #336

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -971,8 +971,8 @@
"dask.config.set({\"dataframe.backend\": \"cudf\"})\n",
"\n",
"df = dd.read_parquet(\n",
" \"gcs://anaconda-public-data/nyc-taxi/2015.parquet\",\n",
" storage_options={\"token\": \"cloud\"},\n",
" \"gcs://anaconda-public-data/nyc-taxi/2015.parquet/part.1*\",\n",
" storage_options={\"token\": \"anon\"},\n",
Copy link
Member Author

@jameslamb jameslamb Feb 5, 2024

Choose a reason for hiding this comment

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

Since that bucket is public, authenticating with GCP isn't necessary. For reference: https://gcsfs.readthedocs.io/en/stable/#credentials

").persist()\n",
"wait(df)\n",
"df"
Expand All @@ -991,16 +991,17 @@
"metadata": {},
"outputs": [],
"source": [
"from cuspatial import haversine_distance\n",
"import cuspatial\n",
"\n",
"\n",
"def map_haversine(part):\n",
" return haversine_distance(\n",
" part[\"pickup_longitude\"],\n",
" part[\"pickup_latitude\"],\n",
" part[\"dropoff_longitude\"],\n",
" part[\"dropoff_latitude\"],\n",
" pickup = cuspatial.GeoSeries.from_points_xy(\n",
" part[[\"pickup_longitude\", \"pickup_latitude\"]].interleave_columns()\n",
" )\n",
" dropoff = cuspatial.GeoSeries.from_points_xy(\n",
" part[[\"dropoff_longitude\", \"dropoff_latitude\"]].interleave_columns()\n",
" )\n",
" return cuspatial.haversine_distance(pickup, dropoff)\n",
"\n",
"\n",
"df[\"haversine_distance\"] = df.map_partitions(map_haversine)"
Expand Down Expand Up @@ -2232,7 +2233,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.15"
"version": "3.9.18"
},
"vscode": {
"interpreter": {
Expand Down
Loading