John Doe 8 Posted November 8, 2020 Share Posted November 8, 2020 Hi, Can anyone give an examplehow to create subsets of a data fileusing Python in newversion of Spotfire Let's say from 'Main_1' I want to create a subset 'Sub_1' (table) etc.I.e. I don't know how to work with In/Out paramters in this context. Link to comment Share on other sites More sharing options...
Colin Gray 3 Posted November 9, 2020 Share Posted November 9, 2020 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now