Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
rbartley
Specialist II
Specialist II

Qlik Sense Python Integration - calling functions with 2 parameters e.g. numpy.percentile

Hi everyone,

I have been able to successfully call other numpy methods such as mean, median, var and std that take only one parameter by using this type of expression:

ScriptPandas.ScriptAggr('qResult = q.std()',Value)

However, the percentile method requires at least 2 parameters https://numpy.org/doc/stable/reference/generated/numpy.percentile.html 


numpy.percentile(a, q, axis=None, out=None, overwrite_input=False, interpolation='linear', keepdims=False)

 

 

1 Solution

Accepted Solutions
rbartley
Specialist II
Specialist II
Author

Ok, I finally found it:-

SSEPython.ScriptAggrEx('D', 'numpy.percentile(args[0][0],85)',Value)

Where the parameter args[0][0] is the field and 85 is the 85th percentile.

 

View solution in original post

2 Replies
rbartley
Specialist II
Specialist II
Author

In case anyone has a similar question, I satisfied the requirement by taking a different approach:  by using the pandas quantile method together with the following expression in order to return the 25th quantile:-

ScriptPandas.ScriptAggr('qResult = q.quantile(0.25)',Value)

rbartley
Specialist II
Specialist II
Author

Ok, I finally found it:-

SSEPython.ScriptAggrEx('D', 'numpy.percentile(args[0][0],85)',Value)

Where the parameter args[0][0] is the field and 85 is the 85th percentile.