<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic API for Python - ArcGIS pro versions 3.0 versus 3.1.x - edit_features in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/api-for-python-arcgis-pro-versions-3-0-versus-3-1/m-p/1397636#M27222</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;We have geoprocessing script tools to run in ArcGIS Pro for updating AGOL hosted feature layer attributes and downloading to local file geodatabases.&lt;/P&gt;
&lt;P&gt;We have been working to switch the python code from arcpy to the API for Python.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the process, I can run the script tools fine on my machine but I'm seeing differences for some of the biologists that need to run the same tools that are getting errors.&lt;/P&gt;
&lt;P&gt;For instance, in line 13 below this line works fine on 2 out of 4 users machines, but on one of them they are using ArcGIS Pro 3.1.x and continue to get the ValueError ("StringArray requires a sequence of strings or pandas.NA")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;if arcpy.Exists(in_track_ln_fc):
    arcpy.AddMessage("Updating track line fields for AKCreationDate, AKDate, Year, Management Area")
    lyr = gis.content.get('xyzxy').layers[1]
    df = lyr.query(where = "AKDate IS Null").sdf
    df['ManagementArea'] = 'xyzx'
    df['start_time'] = df['start_time']- timedelta(hours=16)
    df['end_time'] = df['end_time'] - timedelta(hours=16)
    df['AKCreationDate'] = df['start_time']- timedelta(hours=8)
    df['AKDate'] = (df['AKCreationDate'] + timedelta(days=1)).dt.strftime('%m/%d/%Y')
    df['Year'] = df['start_time'].dt.strftime('%Y')
    df['created_date'] = df['created_date']- timedelta(hours=16)
    df['last_edited_date'] = df['last_edited_date'] - timedelta(hours=16)
    lyr.edit_features(updates = df.spatial.to_featureset())&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I've checked the dataframe and it has the records to update, but I don't understand or know how to fix the error when the code runs fine on my and a coworkers machine. I have ArcGIS Pro 3.0.x still. I'm not sure on the other user.&lt;/P&gt;
&lt;P&gt;Similarly different data but same use of the edit_features and the user is getting an error params["updates'] = json.dumps(&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone else had issues with different versions of ArcGIS Pro and the edit_features? Any insights?&lt;/P&gt;
&lt;P&gt;Thanks in advance!,&lt;BR /&gt;Kathy&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2024 16:49:35 GMT</pubDate>
    <dc:creator>kmsmikrud</dc:creator>
    <dc:date>2024-06-28T16:49:35Z</dc:date>
    <item>
      <title>API for Python - ArcGIS pro versions 3.0 versus 3.1.x - edit_features</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/api-for-python-arcgis-pro-versions-3-0-versus-3-1/m-p/1397636#M27222</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;We have geoprocessing script tools to run in ArcGIS Pro for updating AGOL hosted feature layer attributes and downloading to local file geodatabases.&lt;/P&gt;
&lt;P&gt;We have been working to switch the python code from arcpy to the API for Python.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the process, I can run the script tools fine on my machine but I'm seeing differences for some of the biologists that need to run the same tools that are getting errors.&lt;/P&gt;
&lt;P&gt;For instance, in line 13 below this line works fine on 2 out of 4 users machines, but on one of them they are using ArcGIS Pro 3.1.x and continue to get the ValueError ("StringArray requires a sequence of strings or pandas.NA")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;if arcpy.Exists(in_track_ln_fc):
    arcpy.AddMessage("Updating track line fields for AKCreationDate, AKDate, Year, Management Area")
    lyr = gis.content.get('xyzxy').layers[1]
    df = lyr.query(where = "AKDate IS Null").sdf
    df['ManagementArea'] = 'xyzx'
    df['start_time'] = df['start_time']- timedelta(hours=16)
    df['end_time'] = df['end_time'] - timedelta(hours=16)
    df['AKCreationDate'] = df['start_time']- timedelta(hours=8)
    df['AKDate'] = (df['AKCreationDate'] + timedelta(days=1)).dt.strftime('%m/%d/%Y')
    df['Year'] = df['start_time'].dt.strftime('%Y')
    df['created_date'] = df['created_date']- timedelta(hours=16)
    df['last_edited_date'] = df['last_edited_date'] - timedelta(hours=16)
    lyr.edit_features(updates = df.spatial.to_featureset())&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I've checked the dataframe and it has the records to update, but I don't understand or know how to fix the error when the code runs fine on my and a coworkers machine. I have ArcGIS Pro 3.0.x still. I'm not sure on the other user.&lt;/P&gt;
&lt;P&gt;Similarly different data but same use of the edit_features and the user is getting an error params["updates'] = json.dumps(&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone else had issues with different versions of ArcGIS Pro and the edit_features? Any insights?&lt;/P&gt;
&lt;P&gt;Thanks in advance!,&lt;BR /&gt;Kathy&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 16:49:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/api-for-python-arcgis-pro-versions-3-0-versus-3-1/m-p/1397636#M27222</guid>
      <dc:creator>kmsmikrud</dc:creator>
      <dc:date>2024-06-28T16:49:35Z</dc:date>
    </item>
  </channel>
</rss>

