Jump to content

Python subsets


John Doe 8

Recommended Posts

Hi,

I would recommend watching this Dr Spotfire on how to use Python in Spotfire linked below. What you want to do in your case would be to specify a table input that is your Main_1 table. The name you give this when you create the input parameter for the data function while be how you refer to this data frame in the Python code. Then when you create your subset of this data in the script, you can specify an output parameter from this variable nameof type table again.

 

Quick tip: if you double click on a variable name you want to be an output (or an input) to highlight the text when you edit the data function, you can then right click on this and select create input or output as a quick way to create inputs and outputs to your data function.

https://www.youtube.com/watchv=MXhO3yG6dUg

However, if your script is just subsetting your data by filtering on the columns, I would look at using the Spotfire data canvas instead. You can add a row filter transformation which will filter the data. If you create a copy of Main_1 in Spotfire, and then add the row filter transformation, then you will get the Sub_1 table you want also. This has the potential to be much faster as it is not calling out to Python, and saves having to maintain the Python code.

You can also run data functions inside the data canvas which might work for your example also:

https://www.youtube.com/watchv=z3uhOBmraak&list=PLknbq-WaCOiU95NPfj7jUeVOzVGBwnCUW&index=8

Hope this helps.

Thanks

Colin

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...