Why does for loop copy only first row and not others?

Discussion created by rkgautam on Jan 20, 2012
Latest reply on Jan 23, 2012 by curtvprice
Can you please have a look and help what's wrong with this code? Although it is supposed to copy all values from "MEAN" field to "NDVI" field, somehow, it copies only first row and leaves all other rows "NULL"

Here is the code:

import arcpy
import sys, os, string
from arcpy.sa import *
from arcpy import env

arcpy.env.workspace = "D:\Project\Stanislaus\Timeseries\NDVI.gdb"

Rst = "sep24_ndvi_stanislaus"     
inputFC = "AgFields"
field = "Field_ID"

arcpy.env.overwriteOutput = 1

    outTable = "D:\Project\Stanislaus\Timeseries\zonalstat.dbf"
    arcpy.AddMessage("Processing zonal means...")
    OutZsaT1 = ZonalStatisticsAsTable(inputFC, field, Rst, outTable, "DATA", "MEAN")
    print "completed zonalstat"

    #join fields to annual summary database
    arcpy.AddMessage("Joining zonal mean tables...")
    arcpy.JoinField_management (inputFC, field, outTable, field)
    print "completed joinfield management"

      #add new ndvi fields
    arcpy.AddField_management (inputFC, "NDVI", "float")
    print "completed add field management"
    #Place all rows from annual summary feature class into an Update cursor
    rows = arcpy.UpdateCursor(inputFC)
    #Loop through each row and calculate new fields' value = to old field values
    for row in rows:
        row.NDVI = row.MEAN
        del row
    #print "Error in try block"
    arcpy.AddMessage("Problem in attempting to calculate NDVI means. Check for existence of rasters")
    print arcpy.GetMessages()