<?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 Unable to assign work in workforce, based on pre-defined zones in ArcGIS Workforce Questions</title>
    <link>https://community.esri.com/t5/arcgis-workforce-questions/unable-to-assign-work-in-workforce-based-on-pre/m-p/780225#M335</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am following the examples in this workbook&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/workforce-scripts/blob/master/notebooks/examples/3%20-%20Assigning%20Work.ipynb" title="https://github.com/Esri/workforce-scripts/blob/master/notebooks/examples/3%20-%20Assigning%20Work.ipynb" rel="nofollow noopener noreferrer" target="_blank"&gt;workforce-scripts/3 - Assigning Work.ipynb at master · Esri/workforce-scripts · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because i want to assign work to our workforce based on the predetermined zones from an existing feature layer on the map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have completed my code section like so:&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;for &lt;/SPAN&gt;assignment &lt;SPAN style="color: #cc7832;"&gt;in &lt;/SPAN&gt;assignments:
    contains = squadZones_df[&lt;SPAN style="color: #6a8759;"&gt;"SHAPE"&lt;/SPAN&gt;].geom.contains(Geometry(assignment.geometry))
    containers = squadZones_df[contains]
    &lt;SPAN style="color: #cc7832;"&gt;if not &lt;/SPAN&gt;containers.empty:
        squadZone = containers[&lt;SPAN style="color: #6a8759;"&gt;'OBJECTID'&lt;/SPAN&gt;].iloc[&lt;SPAN style="color: #6897bb;"&gt;0&lt;/SPAN&gt;]
        &lt;SPAN style="color: #cc7832;"&gt;if &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;2&lt;/SPAN&gt;:
            assignment.worker = squad_WSFF
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()
        &lt;SPAN style="color: #cc7832;"&gt;elif &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;5&lt;/SPAN&gt;:
            assignment.worker = squad_LL
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()
        &lt;SPAN style="color: #cc7832;"&gt;elif &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;8&lt;/SPAN&gt;:
            assignment.worker = squad_WG
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()
        &lt;SPAN style="color: #cc7832;"&gt;elif &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;11&lt;/SPAN&gt;:
            assignment.worker = squad_RR
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()
        &lt;SPAN style="color: #cc7832;"&gt;elif &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;16&lt;/SPAN&gt;:
            assignment.worker = squad_HLG
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()
        &lt;SPAN style="color: #cc7832;"&gt;elif &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;18&lt;/SPAN&gt;:
            assignment.worker = squad_JE
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()

assignments = project.assignments.batch_update(assignments)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I keep getting this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "C:/Users/.../PycharmProjects/APITesting/assign_work.py", line 45, in &amp;lt;module&amp;gt;&lt;BR /&gt; containers = squadZones_df[contains]&lt;BR /&gt; File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\frame.py", line 2970, in __getitem__&lt;BR /&gt; if com.is_bool_indexer(key):&lt;BR /&gt; File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\common.py", line 130, in is_bool_indexer&lt;BR /&gt; raise ValueError(na_msg)&lt;BR /&gt;ValueError: cannot index with vector containing NA / NaN values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help with this at all? My feature layer table looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="483776" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/483776_pastedImage_9.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 08:48:39 GMT</pubDate>
    <dc:creator>SimonLaw</dc:creator>
    <dc:date>2021-12-12T08:48:39Z</dc:date>
    <item>
      <title>Unable to assign work in workforce, based on pre-defined zones</title>
      <link>https://community.esri.com/t5/arcgis-workforce-questions/unable-to-assign-work-in-workforce-based-on-pre/m-p/780225#M335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am following the examples in this workbook&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/workforce-scripts/blob/master/notebooks/examples/3%20-%20Assigning%20Work.ipynb" title="https://github.com/Esri/workforce-scripts/blob/master/notebooks/examples/3%20-%20Assigning%20Work.ipynb" rel="nofollow noopener noreferrer" target="_blank"&gt;workforce-scripts/3 - Assigning Work.ipynb at master · Esri/workforce-scripts · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because i want to assign work to our workforce based on the predetermined zones from an existing feature layer on the map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have completed my code section like so:&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;for &lt;/SPAN&gt;assignment &lt;SPAN style="color: #cc7832;"&gt;in &lt;/SPAN&gt;assignments:
    contains = squadZones_df[&lt;SPAN style="color: #6a8759;"&gt;"SHAPE"&lt;/SPAN&gt;].geom.contains(Geometry(assignment.geometry))
    containers = squadZones_df[contains]
    &lt;SPAN style="color: #cc7832;"&gt;if not &lt;/SPAN&gt;containers.empty:
        squadZone = containers[&lt;SPAN style="color: #6a8759;"&gt;'OBJECTID'&lt;/SPAN&gt;].iloc[&lt;SPAN style="color: #6897bb;"&gt;0&lt;/SPAN&gt;]
        &lt;SPAN style="color: #cc7832;"&gt;if &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;2&lt;/SPAN&gt;:
            assignment.worker = squad_WSFF
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()
        &lt;SPAN style="color: #cc7832;"&gt;elif &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;5&lt;/SPAN&gt;:
            assignment.worker = squad_LL
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()
        &lt;SPAN style="color: #cc7832;"&gt;elif &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;8&lt;/SPAN&gt;:
            assignment.worker = squad_WG
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()
        &lt;SPAN style="color: #cc7832;"&gt;elif &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;11&lt;/SPAN&gt;:
            assignment.worker = squad_RR
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()
        &lt;SPAN style="color: #cc7832;"&gt;elif &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;16&lt;/SPAN&gt;:
            assignment.worker = squad_HLG
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()
        &lt;SPAN style="color: #cc7832;"&gt;elif &lt;/SPAN&gt;squadZone == &lt;SPAN style="color: #6897bb;"&gt;18&lt;/SPAN&gt;:
            assignment.worker = squad_JE
            assignment.status = &lt;SPAN style="color: #6a8759;"&gt;"assigned"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;            &lt;/SPAN&gt;assignment.assigned_date = datetime.utcnow()

assignments = project.assignments.batch_update(assignments)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I keep getting this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "C:/Users/.../PycharmProjects/APITesting/assign_work.py", line 45, in &amp;lt;module&amp;gt;&lt;BR /&gt; containers = squadZones_df[contains]&lt;BR /&gt; File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\frame.py", line 2970, in __getitem__&lt;BR /&gt; if com.is_bool_indexer(key):&lt;BR /&gt; File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\common.py", line 130, in is_bool_indexer&lt;BR /&gt; raise ValueError(na_msg)&lt;BR /&gt;ValueError: cannot index with vector containing NA / NaN values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help with this at all? My feature layer table looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="483776" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/483776_pastedImage_9.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:48:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-workforce-questions/unable-to-assign-work-in-workforce-based-on-pre/m-p/780225#M335</guid>
      <dc:creator>SimonLaw</dc:creator>
      <dc:date>2021-12-12T08:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to assign work in workforce, based on pre-defined zones</title>
      <link>https://community.esri.com/t5/arcgis-workforce-questions/unable-to-assign-work-in-workforce-based-on-pre/m-p/780226#M336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;UPDATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;It looks like this part here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;for &lt;/SPAN&gt;assignment &lt;SPAN style="color: #cc7832;"&gt;in &lt;/SPAN&gt;assignments:
    contains = squadZones_df[&lt;SPAN style="color: #6a8759;"&gt;"SHAPE"&lt;/SPAN&gt;].geom.contains(Geometry(assignment.geometry))
    &lt;SPAN style="color: #8888c6;"&gt;print&lt;/SPAN&gt;(contains)&lt;/PRE&gt;&lt;P&gt;Is actually returning "None" in the field values, I added the print check to confirm my suspicions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0 None&lt;BR /&gt;1 None&lt;BR /&gt;2 None&lt;BR /&gt;3 None&lt;BR /&gt;4 None&lt;BR /&gt;5 None&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the assignments are being found ok and the df is being created fine as well with all data contained within.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this help anyone with my query?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:48:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-workforce-questions/unable-to-assign-work-in-workforce-based-on-pre/m-p/780226#M336</guid>
      <dc:creator>SimonLaw</dc:creator>
      <dc:date>2021-12-12T08:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to assign work in workforce, based on pre-defined zones</title>
      <link>https://community.esri.com/t5/arcgis-workforce-questions/unable-to-assign-work-in-workforce-based-on-pre/m-p/780227#M337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have a geometry engine in your python environment (e.g. arcpy or shapely)? If you don't the API will return None rather than True/False. You can install it via&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;conda install -c conda-forge shapely&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2020 16:27:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-workforce-questions/unable-to-assign-work-in-workforce-based-on-pre/m-p/780227#M337</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-03-09T16:27:21Z</dc:date>
    </item>
  </channel>
</rss>

