<jupyter_start><jupyter_text>Oceanbolt Python SDK - International trade of Chinese flagged Supramax fleetExample of Oceanbolt's Python SDK to answer the question - "What is the percentage of the Chinese flagged Supramax fleet that is currently trading internationally and how has this changed throughout 2020?"<jupyter_code># Import the relevant libraries
# In order to get a timeseries number of Chinese flagged Supramax vessels, we use the ChineseWatersTimeseries client (https://python-sdk.oceanbolt.com/tonnage_v3/chinese_waters.html)

from oceanbolt.sdk.client import APIClient
from oceanbolt.sdk.data.tonnage import ChineseWatersTimeseries
from datetime import date
# Create the base API client using your token. Tokens can be created in the Oceanbolt App (app.oceanbolt.com)
base_client = APIClient("<token>")
# Connect to the relevant Oceanbolt data endpoints using the base client object, ie: ChineseWatersTimeseries
chinese_waters_client = ChineseWatersTimeseries(base_client)
# We apply filters to our query to get the timeseries Chinese flagged Supramax fleet and its trading activities
# A complete list of available filters can be found at https://python-sdk.oceanbolt.com/tonnage_v3/chinese_waters.html#arguments

df = chinese_waters_client.get(
   segment=['supramax'],
    start_date=date(2020, 1, 1), 
    end_date=date(2020, 12, 31),
)

#Print 2 first rows of table
df.head(2) 
#In order to get the percentage of the fleet that is engaged in international trade, we do some further manipulation
#If you find you are doing repetitive data manipulations, give us a shout at <EMAIL> and we will look at including your desired metrics directly in the response

#Sum vessel counts to get the total Chinese flagged Supramax fleet
total_fleet = df["inside_chinese_waters_count"] + df["outside_chinese_waters_count"]
df['total_fleet'] = total_fleet
#Calculate percentage trading outside of China
percentage_outside_china = df["outside_chinese_waters_count"] / df['total_fleet']
df['percentage_outside_china'] = percentage_outside_china
#Let's plot the timeseries
df.plot(x='date', y='percentage_outside_china', figsize=(10,10), title='Percentage of Chinese flagged Supramax vessels engaged in international trade');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0673758865248227, 'fraction_numerical': 0.01152482269503546, 'mean_word_length': 6.280645161290322, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '640594', 'license': 'MIT', 'n_tokens_mistral': 674, 'n_tokens_neox': 624, 'n_words': 246, 'path': 'docs/examples/05_chinese_flagged_fleet_development.ipynb', 'repo_name': 'oceanbolt/oceanbolt-python-sdk', 'size': '2267'}