Jupyter Notebook
This tutorial aims to help you and provides guidelines on how to use Wizata Python Toolkit on Jupyter Notebook.
Wizata Python toolkit Installation
It is highly recommended that you have previously read our dedicated article about how to quickly start using the Wizata Python toolkit.
Ensure your are running a notebook on Python 3.9
from platform import python_version
print(python_version())
Make sure you have installed wizata_dsapi on your environment. If not, please use import wizata_dsapi
Set environment variables to connect to Wizata
%env WIZATA_TENANT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
%env WIZATA_CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
%env WIZATA_SCOPE=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/api
%env WIZATA_DOMAIN=xxx-wizard.onwizata.com
%env WIZATA_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxx
Don’t use double quotation (”) in variable value.
Fetching a Dataframe
The ‘client’ can be easily accessed and generated thanks to environment variables and api()
attribute: wizata_dsapi.api()
We have a dedicated Python SDK documentation section with all the available methods and attributes listed.
For example, if you have already followed the steps on our article about how to Upload a small data file through Azure Event Hub, you can fetch data from Wizata using a simple query like this one:
import wizata_dsapi
wizata_dsapi.api().query(
datapoints=["mt1_bearing1"],
start="now-1d",
end="now",
interval=60000
)

Additionally, you can transform data, plot them or train models using Pipelines. We have an example article that you can follow step by step regarding how to create an Anomaly Detection Solution
Visualizing entities content
Wizata Python toolkit also includes a to_json()
method for all the entities on the platform, where you can easily print its content in a notebook.

Showing plots
You can visualize any Wizata plot within your notebook. Using the helper method wizata_dsapi.api().plot()
, you can pass an id, a figure or a Wizata DS API Plot object.
For instance, recalling from the example in our Anomaly Detection Solution, you can use the .get()
method passing the plot title as a key to get a Plot object, and use .plot()
passing the object to visualize the plot in your notebook.
plot = wizata_dsapi.api().get(key="Bearing Anomaly Detection",entity=wizata_dsapi.Plot)
wizata_dsapi.api().plot(plot=plot)
Or by passing the plot's ID:
wizata_dsapi.api().plot("dce9e14d-e0f7-48ea-90ce-08236cd830ca")

Using .plots()
.plots()
Additionally, we can use .plots()
method if we want to get all the plots for an execution. The usage is pretty simple, you need to pass either an execution object or an execution ID inside the method.
You can find your execution ID from the platform, by checking on the Execution logs page
Or via Python, using the .search_executions()
method will retrieve a PagedQueryResult
with all the executions that matches your filters
pipeline_id = wizata_dsapi.api().get(pipeline_key="bearing_anomaly_pipeline").pipeline_id
i = 1
page_size = 20
total = None
has_more = True
execution_list = []
while has_more:
response_paged = wizata_dsapi.api().search_executions(page=i, pipeline_id=pipeline_id, size=page_size)
if i == 1:
total = response_paged.total
for execution in response_paged.results:
if execution.plots:
execution_list.append(execution)
total -= page_size
i += 1
if total <= 0:
has_more = False
For more information you can check our dedicated Python SDK article.
And then using .plots()
with the latest execution:
Updated 27 days ago