下面的行将元组指定为属性值。这是你想要的吗?
original_feature.attributes['GPS_Time'] = (matching_row['GPS_Time'])
如果你想分配值,只需:
original_feature.attributes['GPS_Time'] = matching_row['GPS_Time']
另外,我认为这一行:
flayer.edit_features(updates= features_for_update)
应该:
flayer.edit_features(updates=[feature_to_be_updated])
感谢您的帮助,我能够使用此脚本运行所有操作: 我还在某个时间添加了它需要多长时间
import arcpy, csv, os, time import pandas as pd from arcgis.gis import GIS from pandas import DataFrame from copy import deepcopy start_time = time.time() gis = GIS("url", "user","pass") fc = gis.content.get('ContentID') flayer = fc.layers[0] fset=flayer.query() fields = ('GPS_Time','Visibility','EngineeringSection','Condition') UpdateLayer = "C:\\Users\\user\\Documents\\ArcGIS\\Default.gdb\\data" UpdateTable=DataFrame(arcpy.da.FeatureClassToNumPyArray(UpdateLayer , fields, skip_nulls=True)) overlap_rows = pd.merge(left=fset.sdf, right = UpdateTable, how='inner', on='EngineeringSection') features_for_update = [] all_features = fset.features for EngSec in overlap_rows['EngineeringSection']: original_feature = [f for f in all_features if f.attributes['EngineeringSection'] == EngSec][0] feature_to_be_updated = deepcopy(original_feature) matching_row = UpdateTable.where(UpdateTable['EngineeringSection'] == EngSec).dropna() feature_to_be_updated.attributes['GPS_Time'] = matching_row['GPS_Time'].iloc[0] feature_to_be_updated.attributes['Visibility'] = int(matching_row['Visibility']) feature_to_be_updated.attributes['Condition'] = str(matching_row['Condition'].iloc[0]) update_result = flayer.edit_features(updates=[feature_to_be_updated]) update_result elapsed_time = time.time() - start_time totaltime = time.strftime("%H:%M:%S", time.gmtime(elapsed_time)) print("Total processing time: "+ totaltime)