Skip to content

Commit

Permalink
Update DataSDK (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
abstractalgo authored Jul 29, 2024
1 parent 44ac797 commit e71ef2b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
24 changes: 3 additions & 21 deletions python-notebooks/11 - Pytorch Trip Duration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,13 @@
"- `torch`\n",
"- `missingno`\n",
"- `foursquare.map-sdk`\n",
"- `unfolded.data-sdk`\n",
"- `foursquare.data-sdk`\n",
"\n",
"If running this notebook in Binder, these dependencies should already be installed. If running in Colab, the next cell will install these dependencies. In another environment, you'll need to make sure these dependencies are available by running the following `pip` command in a shell.\n",
"\n",
"```bash\n",
"pip install xarray dask netCDF4 bottleneck tqdm dask-ml pandas seaborn matplotlib scikit-learn category_encoders torch missingno foursquare.map-sdk unfolded.data-sdk\n",
"```\n",
"\n",
"This notebook was originally tested with the following package versions, but likely works with a broad range of versions:\n",
"\n",
"- xarray==0.19.0 \n",
"- dask==2021.09.1 \n",
"- netCDF4==1.5.7 \n",
"- bottleneck==1.3.2 \n",
"- tqdm==4.62.3 \n",
"- dask-ml==1.9.0 \n",
"- pandas==1.3.3 \n",
"- seaborn==0.11.2 \n",
"- matplotlib==3.4.3 \n",
"- scikit-learn==1.0 \n",
"- category_encoders==2.2.2\n",
"- torch==1.9.1 \n",
"- missingno==0.5.0 \n",
"- foursquare.map-sdk==0.5.0\n",
"- unfolded.data-sdk==0.5.0"
"pip install xarray dask netCDF4 bottleneck tqdm dask-ml pandas seaborn matplotlib scikit-learn category_encoders torch missingno foursquare.map-sdk foursquare.data-sdk\n",
"```\n"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions python-notebooks/experimental/bokeh-data-sdk.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"By using Studio's [unfolded.data_sdk](https://pypi.org/project/unfolded.data-sdk/) module with your personal [refresh token](https://studio.unfolded.ai/home/tokens) you have access to our [DataSDK](https://docs.unfolded.ai/data-sdk/use-with-python)"
"By using Studio's [foursquare.data_sdk](https://pypi.org/project/foursquare.data-sdk/) module with your personal [refresh token](https://studio.unfolded.ai/home/tokens) you have access to our [DataSDK](https://docs.unfolded.ai/data-sdk/use-with-python)"
]
},
{
Expand All @@ -72,7 +72,7 @@
"metadata": {},
"outputs": [],
"source": [
"from unfolded.data_sdk import DataSDK, MediaType\n",
"from foursquare.data_sdk import DataSDK, MediaType\n",
"\n",
"data_sdk = DataSDK(refresh_token=\"YOUR_REFRESH_TOKEN\")"
]
Expand Down Expand Up @@ -122,7 +122,7 @@
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mDriverError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-6-b1f7bc74e189>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdata_sdk\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdownload_dataframe\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdataset\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msample\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.8/site-packages/unfolded/data_sdk/data_sdk.py\u001b[0m in \u001b[0;36mdownload_dataframe\u001b[0;34m(self, dataset, **kwargs)\u001b[0m\n\u001b[1;32m 248\u001b[0m )\n\u001b[1;32m 249\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 250\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbio\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 251\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 252\u001b[0m \u001b[0;31m# Unfortunately, Studio doesn't put the correct content type on\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.8/site-packages/foursquare/data_sdk/data_sdk.py\u001b[0m in \u001b[0;36mdownload_dataframe\u001b[0;34m(self, dataset, **kwargs)\u001b[0m\n\u001b[1;32m 248\u001b[0m )\n\u001b[1;32m 249\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 250\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbio\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 251\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 252\u001b[0m \u001b[0;31m# Unfortunately, Studio doesn't put the correct content type on\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.8/site-packages/geopandas/io/file.py\u001b[0m in \u001b[0;36m_read_file\u001b[0;34m(filename, bbox, mask, rows, **kwargs)\u001b[0m\n\u001b[1;32m 158\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 159\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mfiona_env\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 160\u001b[0;31m \u001b[0;32mwith\u001b[0m \u001b[0mreader\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpath_or_bytes\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mfeatures\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 161\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 162\u001b[0m \u001b[0;31m# In a future Fiona release the crs attribute of features will\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.8/site-packages/fiona/collection.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, bytesbuf, **kwds)\u001b[0m\n\u001b[1;32m 553\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 554\u001b[0m \u001b[0;31m# Instantiate the parent class.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m super(BytesCollection, self).__init__(self.virtual_file, vsi=filetype,\n\u001b[0m\u001b[1;32m 556\u001b[0m encoding='utf-8', **kwds)\n\u001b[1;32m 557\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.8/site-packages/fiona/collection.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, **kwargs)\u001b[0m\n\u001b[1;32m 160\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmode\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'r'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 161\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msession\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSession\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 162\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 163\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmode\u001b[0m \u001b[0;32min\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m'a'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'w'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 164\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msession\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mWritingSession\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ seaborn
sidecar
tensorflow
torch
unfolded.data-sdk>=0.7.0
foursquare.map-sdk>=2.0.0
foursquare.data-sdk
foursquare.map-sdk
xarray

0 comments on commit e71ef2b

Please sign in to comment.