How to do a Column Calculation using multiple rows with some empty cells
Hi I am trying to calculate the difference between two rows within a column using python and then insert it into a table. My problem is that I have empty cells (that i need to remain in place. I have included an example of a script i have tried but get a index out of range error. I have also tried "try and except" commands in my scripts but ran into similar errors. Im very new to python and spotfire and would greatly appreciate the help!
|1||leave blank OR set to -999.25|
from Spotfire.Dxp.Data import * from System.Collections.Generic import List #get the data table table=Document.Data.Tables["LAS OnDemand"] #place generic data cursor on a specific column cursor = DataValueCursor.CreateFormatted(table.Columns["B"]) #list object to store retrieved values valData = List [str](); #iterate through table column rows to retrieve the values for row in table.GetRows(cursor): value = cursor.CurrentValue if value <> str.Empty: valData.Add(value) diff =  for i in range(len(valData)-1): if valData[i].isdigit(): a= float (valData[i]) else: a=-999.25 if valData[i+1].isdigit(): b= float (valData[i+1]) else: b=-999.25 diff[i]=b-a