Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
asma-sm
Contributor II
Contributor II

add python script to Qlick sense

Hello,

I'm new to Qlick sens, I'm trying to add a python script to Qlick sense.

i want to make an app that allows to impute missing data to xlsx file using sickit learn imputers and then make data visualization , my python code looks  like:

 

# features selection then,
imputer=  IterativeImputer(random_state=0, estimator= 
                         ExtraTreesRegressor(n_estimators=10, random_state=0))
imputed_data=imputer.fit_transform(dataset_to_impute)

 

 i have seen these examples:

https://github.com/qlik-oss/server-side-extension/tree/master/examples/python

but i didn't know how to do it in my case!

Please, can anyone help?

Labels (2)
1 Solution

Accepted Solutions
asma-sm
Contributor II
Contributor II
Author

Hello, I'm back again!

So, to integrate python script to Qlick Sense you can use server-side extension (SSE) it exposes  Qlik data to an external scripting/programming language (python in our case) through remote procedure calls (RPCs).

Here we are going to passe DATA to python in a request (it is which is an iterator object made of multiple bundled rows)

  1. install these packages: grpcio, pandas and scikit-learn
    pip install grpcio
    pip install pandas
    python -m pip install grpcio-tools
    pip install scikit-learn
  2. Edit your Settings.ini file, in windows you can find it in :
    C:\Users\nameOfUser\Documents\Qlik\Sense
  3. Add the following line to the Settings files,                                                                                                                                   SSEPlugin = Imputer,localhost:50051                                                                                                                                                         (the port's number is in "__main.py" line 242,you can change it)
  4.  Use the files in my git repo:                                                      https://github.com/asmaalegat/Qlick_data_imputation_example                                                                                                     (I reused files from https://github.com/danielpilla/qlik-python-sse-nfl-playbyplay-predictions )
  5. Add the the application (qvf file) to the directory of qlick sense apps
  6.  Close qlick sense and run   python script in cmd:
    python __main__.py
  7. launch Qlick Sense app

To add other functions or customize your application according to your need you can edit
the two files:

  • "functions.json" (it defines the metadata associated with each custom function )

  • "__main__.py" you can edit the function "impute" or add other functions (don't forget to
    add it to the json file)

Custom functions  are callable from the Qlik Sense front-end.
In the example I made i called the function "impute" to recuperate my data with imputed data by adding
an expression in your Qlick app :
pluginName.funtionName(col1,col2,col_n)   // your function's parameters
in the example expression is added to "imputed data" table's columns:
Imputer.Impute(Age,High,Weight)

To understand well how the SSE works and each function in python's code you can read this article
https://www.axisgroup.com/data-industry-insights-blog/qlik-sense-server-side-extensions-part-13-arch... 

View solution in original post

2 Replies
Varun1
Partner - Contributor III
Partner - Contributor III

Hi,

I have the same query.

@sunny_talwar  can you please help us out.

 

Regards,

Varun

asma-sm
Contributor II
Contributor II
Author

Hello, I'm back again!

So, to integrate python script to Qlick Sense you can use server-side extension (SSE) it exposes  Qlik data to an external scripting/programming language (python in our case) through remote procedure calls (RPCs).

Here we are going to passe DATA to python in a request (it is which is an iterator object made of multiple bundled rows)

  1. install these packages: grpcio, pandas and scikit-learn
    pip install grpcio
    pip install pandas
    python -m pip install grpcio-tools
    pip install scikit-learn
  2. Edit your Settings.ini file, in windows you can find it in :
    C:\Users\nameOfUser\Documents\Qlik\Sense
  3. Add the following line to the Settings files,                                                                                                                                   SSEPlugin = Imputer,localhost:50051                                                                                                                                                         (the port's number is in "__main.py" line 242,you can change it)
  4.  Use the files in my git repo:                                                      https://github.com/asmaalegat/Qlick_data_imputation_example                                                                                                     (I reused files from https://github.com/danielpilla/qlik-python-sse-nfl-playbyplay-predictions )
  5. Add the the application (qvf file) to the directory of qlick sense apps
  6.  Close qlick sense and run   python script in cmd:
    python __main__.py
  7. launch Qlick Sense app

To add other functions or customize your application according to your need you can edit
the two files:

  • "functions.json" (it defines the metadata associated with each custom function )

  • "__main__.py" you can edit the function "impute" or add other functions (don't forget to
    add it to the json file)

Custom functions  are callable from the Qlik Sense front-end.
In the example I made i called the function "impute" to recuperate my data with imputed data by adding
an expression in your Qlick app :
pluginName.funtionName(col1,col2,col_n)   // your function's parameters
in the example expression is added to "imputed data" table's columns:
Imputer.Impute(Age,High,Weight)

To understand well how the SSE works and each function in python's code you can read this article
https://www.axisgroup.com/data-industry-insights-blog/qlik-sense-server-side-extensions-part-13-arch...