Jump to content

How to return a complete row based on a value search on a column of a data table in IronPython script

Rohit Madan 2

Recommended Posts

I am trying to take a user input to find a value in a column. If found, I want to return the row (basically something like a iloc/loc function does in pandas package).

I need to use a different column value of the row in which the initial different column value is found.

I need to put this ironpython script in spotfire.


Thanks in Advance,


Link to comment
Share on other sites

You can use the below sample script to read the user input and then get the column value from that row

from Spotfire.Dxp.Data import *

from System.Collections.Generic import List



#get the user Input


#where clause



# Create a cursor to the Column we wish to get the values from

cursor = DataValueCursor.CreateFormatted(table.Columns["Store ID"])


# Create List object that will hold values if there will be multiple values



# Loop through all rows, retrieve value for specific column,

# and add value into list

for row in table.GetRows(rowSelection.AsIndexSet(),cursor):

rowIndex = row.Index

value1 = cursor.CurrentValue




print listofValues

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...