I am trying to write a python script to extract certain values from a table: the table I am referring to is a big collection of nitrate values for different water depths, which are deposited in the columns of the table. As I only need the value of the surface and the deepest point, I want to search through the rows and extract the last value that is not 0. I have started writing a script using the SearchCursor Tool but get stuck at the point, where I want it to search for the first 0-value and then go back and print the value fro mthe column before... Does anyone have an idea how to solve that problem?
import arcpy # Set the Workspace arcpy.env.workspace = "D:\Teresa\Kerstin\SouthernOcean\03_workspace\Teresa" # Make table table = "C:/Users/theidema/Desktop/OxzUti_GridP_Annual.csv" #Create the search cursor cursor = arcpy.SearchCursor(Table) #Iterate through the rows row = cursor.next() while row: print (row.getValue(field)) row = cursor.next()
Here is a Screenshot of the table (depths go down until 5500M)