The TSIClient is a Python SDK for Microsoft Azure time series insights. It provides methods to conveniently retrieve your data and is designed for analysts, data scientists and developers working with time series data in Azure TSI.
- Azure time series REST APIs: https://docs.microsoft.com/en-us/rest/api/time-series-insights/
- TSIClient: https://raalabs-tsiclient.readthedocs.io/en/latest/
We recommended to use a Python version >= 3.6. You can install the TSIClient from PyPi:
pip install TSIClient
Or if you want to get the latest code, directly fom GitHub:
pip install git+https://github.com/RaaLabs/TSIClient.git
Instantiate the TSIClient to query your TSI environment. Use the credentials from your service principal in Azure that has access to the TSI environment (you can also use environment variables to instantiate the TSIClient, check the documentation).
from TSIClient import TSIClient as tsi
client = tsi.TSIClient(
enviroment="<your-tsi-env-name>",
client_id="<your-client-id>",
client_secret="<your-client-secret>",
tenant_id="<your-tenant-id>",
applicationName="<your-app-name>">
)
You can query your timeseries data by timeseries id, timeseries name or timeseries description. The Microsoft TSI apis support aggregation, so you can specify a sampling freqency and an aggregation method. Refer to the documentation for detailed information.
data = client.getDataById(
timeseries=["timeseries_id1", "timeseries_id2"],
timespan=["2019-12-12T15:35:11.68Z", "2019-12-12T17:02:05.958Z"],
interval="PT5M",
aggregate="avg",
useWarmStore=False
)
This returns a pandas dataframe, which can be used for analysis.
Contributions are welcome. See the developer reference for details.
TSIClient is licensed under the MIT license. See LICENSE file for details.