Hi All,
I'm currently using a search cursor to read data from a feature class in a Jupyter Notebook ArcGIS Pro. I'd like to migrate out of ArcGIS Pro and use a simple csv reader to return a value from a function.
Basically, I need to loop through a list of locations ('Nodes'), and find the row for that location, then calculate the value of a function based on the values of other columns in that row.
While I have a search cursor that works as intended, I'm unsure how to loop through the csv and reference the value of one column based on the value of another column.
The search cursor looks like this:
def Function2GetAValue(Node,Prop,Time):
fields = [LIST OF FIELDS HERE]
with arcpy.da.SearchCursor(f'FeatureClass{time},fields) as cursor:
for row in cursor:
if Node == row[0]:
Value = ((Prop+ row[1] + row[2]) * row[3])
return (round(Value,2))
What I'd like to have is something closer to this:
import pandas a pd
GETaValueFromFC = fr"PATHTOTHEFEATURECLASSTABLE{time}.csv"
dfT=pd.read_csv(GETaValueFromFC)
for index, row in dfT.iterrows():
if ['Node'] == currentNode:
DM = ((Prop + row[COLUMname] + row[COLUMname]) * row[COLUMname])
return (round(float(VALUE),2))