<?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 Re: Workforce - Import Assignments from a CSV - AttributeError in ArcGIS Workforce Questions</title>
    <link>https://community.esri.com/t5/arcgis-workforce-questions/workforce-import-assignments-from-a-csv/m-p/1204193#M2483</link>
    <description>&lt;P&gt;Hi Graeme,&lt;/P&gt;&lt;P&gt;Thanks for your response. It has allowed me to get past the error. The rows from the csv have been successfully added to the table, although they do not appear as points on the map. When I select a row from the table, the Zoom to Selection option does not result in any map action. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;for index, row in df.iterrows():
    geometry = {"x" : row['xField'], "y" : row['yField']}
geometry&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{'x': -62.764349, 'y': 46.728903}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the format I am passing to workforce which seems to be the same as when I tried a geocoded address.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Aug 2022 14:56:32 GMT</pubDate>
    <dc:creator>ejuser</dc:creator>
    <dc:date>2022-08-18T14:56:32Z</dc:date>
    <item>
      <title>Workforce - Import Assignments from a CSV - AttributeError</title>
      <link>https://community.esri.com/t5/arcgis-workforce-questions/workforce-import-assignments-from-a-csv/m-p/1203475#M2475</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;I'm using Jupyter Notebook in ArcGIS Pro 2.9.3. I am attempting to create assignments in Workforce using a CSV file.&lt;BR /&gt;&lt;BR /&gt;I have used the code samples provided online related to this topic and cannot get mine to work. I apologize in advance for posting the table and code as images. The formatting was off when attempting to place in the body.&lt;BR /&gt;&lt;BR /&gt;I tried commenting out the line generating the error and another line would be the cause.  &lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;TABLE border="0" width="704" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="64" height="20"&gt;xField&lt;/TD&gt;&lt;TD width="64"&gt;yField&lt;/TD&gt;&lt;TD width="64"&gt;Type&lt;/TD&gt;&lt;TD width="64"&gt;Location&lt;/TD&gt;&lt;TD width="64"&gt;Dispatcher&lt;/TD&gt;&lt;TD width="64"&gt;Description&lt;/TD&gt;&lt;TD width="64"&gt;Priority&lt;/TD&gt;&lt;TD width="64"&gt;WorkOrderId&lt;/TD&gt;&lt;TD width="64"&gt;DueDate&lt;/TD&gt;&lt;TD width="64"&gt;Attachment&lt;/TD&gt;&lt;TD width="64"&gt;Worker&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;-57.8306&lt;/TD&gt;&lt;TD&gt;43.31751&lt;/TD&gt;&lt;TD&gt;Quality Inspection&lt;/TD&gt;&lt;TD&gt;NB&lt;/TD&gt;&lt;TD&gt;RT&lt;/TD&gt;&lt;TD&gt;Mc&lt;/TD&gt;&lt;TD&gt;None&lt;/TD&gt;&lt;TD&gt;55553003&lt;/TD&gt;&lt;TD&gt;########&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;PK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;-59.6505&lt;/TD&gt;&lt;TD&gt;42.64011&lt;/TD&gt;&lt;TD&gt;Quality Inspection&lt;/TD&gt;&lt;TD&gt;NB&lt;/TD&gt;&lt;TD&gt;RT&lt;/TD&gt;&lt;TD&gt;G&lt;/TD&gt;&lt;TD&gt;None&lt;/TD&gt;&lt;TD&gt;65521560&lt;/TD&gt;&lt;TD&gt;########&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;PK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;-59.5653&lt;/TD&gt;&lt;TD&gt;42.6353&lt;/TD&gt;&lt;TD&gt;Quality Inspection&lt;/TD&gt;&lt;TD&gt;NB&lt;/TD&gt;&lt;TD&gt;RT&lt;/TD&gt;&lt;TD&gt;G&lt;/TD&gt;&lt;TD&gt;None&lt;/TD&gt;&lt;TD&gt;65521740&lt;/TD&gt;&lt;TD&gt;########&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;PK&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;df = pd.read_csv("Workforce_July_Inspects.csv")
vu_assignments = []
for index, row in df.iterrows():
    geometry = {"x" : row['xField'], "y" : row['yField'], "spatialReference" : {"wkid" : 4326}},
    vu_assignments.append(
        workforce.Assignment(
            project,
            geometry=geometry,
            location=row['Location'],
            description=row['Description'],
            priority=row['Priority'],
            work_order_id=row['WorkOrderId'],
            #assigned_date=datetime.now(),
            due_date=row['DueDate'],
            worker=row['Worker'],
            dispatcher=row['Dispatcher'],
            assignment_type='Quality Inspection'
            #assignment_type=row['Type']
            #status="assigned"
        )
    )
project.assignments.batch_add(assignments)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;&lt;BR /&gt;The error I got was:&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;---------------------------------------------------------------------------&lt;/SPAN&gt; &lt;SPAN class=""&gt;AttributeError&lt;/SPAN&gt; Traceback (most recent call last) In &lt;SPAN class=""&gt;[42]&lt;/SPAN&gt;: Line &lt;SPAN class=""&gt;17&lt;/SPAN&gt;: assignment_type=&lt;SPAN class=""&gt;'&lt;/SPAN&gt;&lt;SPAN class=""&gt;Quality Inspection&lt;/SPAN&gt;&lt;SPAN class=""&gt;'&lt;/SPAN&gt; File &lt;SPAN class=""&gt;C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\apps\workforce\assignment.py&lt;/SPAN&gt;, in &lt;SPAN class=""&gt;__init__&lt;/SPAN&gt;: Line &lt;SPAN class=""&gt;182&lt;/SPAN&gt;: &lt;SPAN class=""&gt;self&lt;/SPAN&gt;.due_date = due_date File &lt;SPAN class=""&gt;C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\apps\workforce\assignment.py&lt;/SPAN&gt;, in &lt;SPAN class=""&gt;due_date&lt;/SPAN&gt;: Line &lt;SPAN class=""&gt;467&lt;/SPAN&gt;: &lt;SPAN class=""&gt;self&lt;/SPAN&gt;._set_datetime_attr(&lt;SPAN class=""&gt;self&lt;/SPAN&gt;._schema.due_date, value) File &lt;SPAN class=""&gt;C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\apps\workforce\feature_model.py&lt;/SPAN&gt;, in &lt;SPAN class=""&gt;_set_datetime_attr&lt;/SPAN&gt;: Line &lt;SPAN class=""&gt;111&lt;/SPAN&gt;: timestamp = to_arcgis_date(value) &lt;SPAN class=""&gt;if&lt;/SPAN&gt; value &lt;SPAN class=""&gt;is&lt;/SPAN&gt; &lt;SPAN class=""&gt;not&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt; &lt;SPAN class=""&gt;else&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt; File &lt;SPAN class=""&gt;C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\apps\workforce\utils.py&lt;/SPAN&gt;, in &lt;SPAN class=""&gt;to_arcgis_date&lt;/SPAN&gt;: Line &lt;SPAN class=""&gt;23&lt;/SPAN&gt;: &lt;SPAN class=""&gt;return&lt;/SPAN&gt; datetime_obj.timestamp() * &lt;SPAN class=""&gt;1000&lt;/SPAN&gt; &lt;SPAN class=""&gt;AttributeError&lt;/SPAN&gt;: 'str' object has no attribute 'timestamp' &lt;SPAN class=""&gt;---------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/PRE&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;</description>
      <pubDate>Wed, 17 Aug 2022 16:58:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-workforce-questions/workforce-import-assignments-from-a-csv/m-p/1203475#M2475</guid>
      <dc:creator>ejuser</dc:creator>
      <dc:date>2022-08-17T16:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Workforce - Import Assignments from a CSV - AttributeError</title>
      <link>https://community.esri.com/t5/arcgis-workforce-questions/workforce-import-assignments-from-a-csv/m-p/1204063#M2478</link>
      <description>&lt;P&gt;Hi ejuser,&lt;/P&gt;&lt;P&gt;It looks like the issue is with the due date, it is passing as a string but the api is expecting a python datetime object. Have a look at&amp;nbsp;strptime() to convert the csv due date column to a datetime object, strptime requires the formatting of the date time string in your csv but it's showing as ###### in the image. Timezone might be another issue for you to think about.&lt;/P&gt;&lt;P&gt;Cheers, Graeme&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 05:29:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-workforce-questions/workforce-import-assignments-from-a-csv/m-p/1204063#M2478</guid>
      <dc:creator>graeme_hill</dc:creator>
      <dc:date>2022-08-18T05:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Workforce - Import Assignments from a CSV - AttributeError</title>
      <link>https://community.esri.com/t5/arcgis-workforce-questions/workforce-import-assignments-from-a-csv/m-p/1204193#M2483</link>
      <description>&lt;P&gt;Hi Graeme,&lt;/P&gt;&lt;P&gt;Thanks for your response. It has allowed me to get past the error. The rows from the csv have been successfully added to the table, although they do not appear as points on the map. When I select a row from the table, the Zoom to Selection option does not result in any map action. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;for index, row in df.iterrows():
    geometry = {"x" : row['xField'], "y" : row['yField']}
geometry&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{'x': -62.764349, 'y': 46.728903}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the format I am passing to workforce which seems to be the same as when I tried a geocoded address.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 14:56:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-workforce-questions/workforce-import-assignments-from-a-csv/m-p/1204193#M2483</guid>
      <dc:creator>ejuser</dc:creator>
      <dc:date>2022-08-18T14:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Workforce - Import Assignments from a CSV - AttributeError</title>
      <link>https://community.esri.com/t5/arcgis-workforce-questions/workforce-import-assignments-from-a-csv/m-p/1204360#M2484</link>
      <description>&lt;P&gt;I don't think you are correctly defining the geometry point object. Check out this guide&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/guide/part2-working-with-geometries/" target="_blank"&gt;Part 2 - Working with Geometries | ArcGIS API for Python&lt;/A&gt;&amp;nbsp;You are looking at the first example for creating a point, it might look something like this&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.geometry import Point
for index, row in df.iterrows():
    geometry = Point({"x" : row['xField'], "y" : row['yField'], "spatialReference" : {"wkid" : 4326}})
    &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 23:38:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-workforce-questions/workforce-import-assignments-from-a-csv/m-p/1204360#M2484</guid>
      <dc:creator>graeme_hill</dc:creator>
      <dc:date>2022-08-18T23:38:24Z</dc:date>
    </item>
  </channel>
</rss>

