.. role:: python(code) :language: python 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 :python:`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 :python:`TrendMinerClient` object is as simple as (note :python:`'{password.TM_TOKEN}'` is detected and replaced with your current OAuth2 token): .. code-block:: python 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: .. code-block:: python from trendminer.trendminer_client import TrendMinerClient client = TrendMinerClient('', '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 :python:`3b509262-6c68-430c-a494-53882364fd20` is a valid identifier of a TrendMiner view you can retrieve time series data as follows: .. code-block:: python from trendminer.trendminer_client import TrendMinerClient from trendminer.views.views import Views client = TrendMinerClient('', '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') Overview of packages ==================== .. toctree:: :maxdepth: 3 :glob: api/trendminer Indices and tables ================== * :ref:`modindex`