{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Try out the VortexaSDK" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First let's import our requirements" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2024-04-05T11:17:13.956707Z", "iopub.status.busy": "2024-04-05T11:17:13.956131Z", "iopub.status.idle": "2024-04-05T11:17:14.344989Z", "shell.execute_reply": "2024-04-05T11:17:14.344587Z" } }, "outputs": [], "source": [ "from datetime import datetime, timedelta, time\n", "import vortexasdk as v" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lets use the CanalTransitTimeseries endpoint to answer the following question:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- _What was the number of vessels waiting to enter Panama Canal yesterday_?" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2024-04-05T11:17:14.347598Z", "iopub.status.busy": "2024-04-05T11:17:14.347390Z", "iopub.status.idle": "2024-04-05T11:17:14.532165Z", "shell.execute_reply": "2024-04-05T11:17:14.531550Z" } }, "outputs": [], "source": [ "search_result = v.CanalTransitTimeseries().search(\n", " metric=\"count_of_vessels\",\n", " timeseries_frequency=\"day\",\n", " time_max=datetime.combine(datetime.now(), time.max),\n", " time_min=datetime.combine(datetime.now() - timedelta(days=1), time.min),\n", " timeseries_activity=\"started_waiting\"\n", " )" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2024-04-05T11:17:14.535683Z", "iopub.status.busy": "2024-04-05T11:17:14.535437Z", "iopub.status.idle": "2024-04-05T11:17:15.059448Z", "shell.execute_reply": "2024-04-05T11:17:15.058756Z" } }, "outputs": [], "source": [ "df = search_result.to_df()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2024-04-05T11:17:15.062252Z", "iopub.status.busy": "2024-04-05T11:17:15.062063Z", "iopub.status.idle": "2024-04-05T11:17:15.073400Z", "shell.execute_reply": "2024-04-05T11:17:15.073014Z" } }, "outputs": [], "source": [ "df.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "That's it! You've successfully loaded data using the Vortexa SDK. Check out https://vortechsa.github.io/python-sdk/ for more examples" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 4 }