AttributeError: 'float' object has no attribute 'setValue'

10469
1
Jump to solution
06-10-2013 09:13 AM
JohnLay
Occasional Contributor
I'm hoping someone can tell me whats going on with the below bit of code. I keep getting the error

AttributeError: 'float' object has no attribute 'setValue'

and I'm not sure how to resolve it. Can someone please explain?

    NONFLOOD = "GRIDfield"
    NF1curs = arcpy.UpdateCursor(BuildingGridSelect)
    for nf1row in NF1curs:
        nf1val = nf1row.getValue(NONFLOOD)
        if nf1val < 0:
            nf1val.setValue(NONFLOOD, 0)
        NF1curs.updateRow(nf1row)


nf1val may result in a negative float value (e.g. -2.32076), but what is the correct syntax to update the value to 0?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JohnLay
Occasional Contributor
Never mind. I see my problem.

nf1val.setValue(NONFLOOD, 0)


should be

nf1row.setValue(NONFLOOD, 0)

View solution in original post

0 Kudos
1 Reply
JohnLay
Occasional Contributor
Never mind. I see my problem.

nf1val.setValue(NONFLOOD, 0)


should be

nf1row.setValue(NONFLOOD, 0)
0 Kudos