Vortexa’s Python SDK for a Programming Novice

Vortexa’s Python SDK for a Programming Novice

Python for beginners

15 July, 2020
Vortexa Analysts
Vortexa Analysts

  1. Mentors on my team who I could turn to when I was having an issue – Vortexa’s data scientists and engineers were more than willing to take time out of their day to help me build a complex query.
  2. Practice. The more queries I did the easier it became.

In the office raising money for Movember with two of my mentors Tino von Stegmann (left) and Kit Burgess (middle)

Getting Started

In the SDK documentation, there is a setup FAQ section, found here. It covers everything you need to know to get started using the SDK on your machine; including where to request a demo.

Importing Modules and Libraries

At the start of the notebook, we have to import the libraries and modules which we are going to be using. In this notebook, we use three of the Vortexa SDK’s endpoints, the DateTime library, Pandas and Matplotlib. To use them in the notebook, we have to import them like this:

from vortexasdk import Products, CargoTimeSeries, Geographies
from datetime import datetime
import pandas as pd
import matplotlib.pyplot as plt
Products Endpoint Tutorial

First I’m going to show you how to get the Vortexa ID for a product you are interested in studying from the products endpoint. Whilst there are many ways of doing this, I will show you just one example that I believed was the best option. In the documentation for the products endpoint, we can see an example line of code which shows us how to look in for different products in a list.

df = Products().search(term=['diesel', 'fuel oil', 'grane']).to_df()
crude_search_df = Products().search(term=['crude']).to_df()
crude_search_df.query("name=='Crude/Condensates'")
pd.set_option('max_colwidth', 75)
CargoTimeSeries Endpoint Tutorial

First, let’s look at the example in the documentation:

Screenshot 2020-07-15 at 17.21.04CargoTimeSeries endpoint example from the SDK documentation
Screenshot 2020-07-15 at 17.21.24CargoTimeSeries endpoint example query changed to return floating storage in China
Exporting your data as a CSV

If you would like to export the final DataFrame as a CSV, use the following :

df_fs.to_csv('~/Desktop/chinese_floating_storage.csv')
Final Thoughts

Today we’ve learned how to take example code from Vortexa’s Python SDK documentation and change it to fit a real-world example. This is a skill you can translate to any Python package. If you would like to look into more examples for the Vortexa SDK you can find all of the documentation here.

Vortexa Analysts
Vortexa
Vortexa Analysts