Documentation for TrendMiner’s Python SDK

The TrendMiner Python SDK allows you to interact with TrendMiner via a high-level API from any Python runtime, e.g. from a Python notebook embedded within TrendMiner. Most boilerplate code has been written for you, so you can focus on what is important: get valuable insights from your time series data.

To interact with TrendMiner via this SDK, you will first have to create a TrendMinerClient object. The creation of such an object requires the URL of your TrendMiner installation and an OAuth2 token. However, if you are working from a TrendMiner embedded notebook, we simplified this for you and creating a TrendMinerClient object is as simple as (note {password.TM_TOKEN} is detected and replaced with your current OAuth2 token):

from trendminer.trendminer_client import TrendMinerClient

client = TrendMinerClient('{password.TM_TOKEN}')

If however, you are working from an external environment, you must provide a valid OAuth2 token and TrendMiner URL:

from trendminer.trendminer_client import TrendMinerClient

client = TrendMinerClient('<oauth2_token>', 'https://trendminer.yourcompany.com')

The client object is used for passing necessary information around within the SDK. For example, if you want to retrieve time series data as a pandas dataframe, you will need a Views object that requires in turn such a TrendMinerClient object. Assuming that 3b509262-6c68-430c-a494-53882364fd20 is a valid identifier of a TrendMiner view you can retrieve time series data as follows:

from trendminer.trendminer_client import TrendMinerClient
from trendminer.views.views import Views

client = TrendMinerClient('<oauth2_token>', 'https://trendminer.yourcompany.com')
views = Views(client)

# One data frame per layer in the view
data_frames = view.load_view('3b509262-6c68-430c-a494-53882364fd20')

Indices and tables