<?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: Help to calculate a field for duplicate record in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129740#M63378</link>
    <description>&lt;P&gt;I haven't, I will look into those, thank you. Have you used those before and been able to preserve a field value from the records being deleted?&lt;/P&gt;</description>
    <pubDate>Thu, 30 Dec 2021 20:36:00 GMT</pubDate>
    <dc:creator>_Kara_</dc:creator>
    <dc:date>2021-12-30T20:36:00Z</dc:date>
    <item>
      <title>Help to calculate a field from duplicate record</title>
      <link>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129726#M63376</link>
      <description>&lt;P&gt;I have a polygon feature class (19,664 features) that approximately half of are duplicates. One of each is mostly null but has one attribute that I need to populate the other with before I delete the mostly null feature. (This happened as a result of combining two different feature classes during a gdb restructure migration.)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KaraPrather_0-1640894446837.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/30533i033076E112324C86/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KaraPrather_0-1640894446837.png" alt="KaraPrather_0-1640894446837.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The Room ID matches for the duplicate features and the number in Room Name is what I need to replace the "ROOM NAME" text values. Some Room ID's are repeated more than twice, so there is more than one record to change sometimes. I'm pretty new to Python so I've been trying a few things but nothing has worked yet. Any help or tips would be greatly appreciated. I'm using ArcMap 10.6.1&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 20:32:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129726#M63376</guid>
      <dc:creator>_Kara_</dc:creator>
      <dc:date>2021-12-30T20:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help to calculate a field for duplicate record</title>
      <link>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129735#M63377</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/find-identical.htm" target="_blank"&gt;Find Identical (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Have you looked at identifying them and see if trying this on a copy of your gdb would work?&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/delete-identical.htm" target="_blank"&gt;Delete Identical (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Exclude your Room Name column in the comparison&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 20:24:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129735#M63377</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-30T20:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Help to calculate a field for duplicate record</title>
      <link>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129740#M63378</link>
      <description>&lt;P&gt;I haven't, I will look into those, thank you. Have you used those before and been able to preserve a field value from the records being deleted?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 20:36:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129740#M63378</guid>
      <dc:creator>_Kara_</dc:creator>
      <dc:date>2021-12-30T20:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help to calculate a field from duplicate record</title>
      <link>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129769#M63380</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/548405"&gt;@_Kara_&lt;/a&gt;&amp;nbsp;it depends on the table.&amp;nbsp; Technically the results of identifying the duplicates into a separate file would allow one to split that table into two parts... the parts that you want to keep and the records that you don't.&amp;nbsp; You would have two tables then and you should be able to join the tables to keep the bits you want.&lt;/P&gt;&lt;P&gt;In your simple example, a query on the RoomName field which has just Room Name as an entry would be simple.&amp;nbsp; All those records could be saved to a new file.&amp;nbsp; Then Switch Selection in the table and save to another file.&amp;nbsp; You then have 2 tables and you could join the 2 together using the room_id field.&amp;nbsp; What you do with it after that might suggest other changes&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 23:31:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129769#M63380</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-30T23:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Help to calculate a field from duplicate record</title>
      <link>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129894#M63384</link>
      <description>&lt;P&gt;I suggest to apply query on this and select all the Room selector fields. Afterwards go to field calculator and in arcade/python, put value what ever you like or calculate as you desire. I think you can also edit it after importing table into csv and then apply filter and then make require editing's. I hope this will help you out.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 20:11:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1129894#M63384</guid>
      <dc:creator>SukhwinderSingh</dc:creator>
      <dc:date>2021-12-31T20:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help to calculate a field from duplicate record</title>
      <link>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1130014#M63387</link>
      <description>&lt;P&gt;NOT TESTED AT ALL, TEST FIRST ON A COPY OF YOUR FC!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fc = "path:/to/your/fc"

# the screenshot you shared shows the field aliases (they have spaces).
# you need to use the actual field names in this script!

# get the correct room names as dict {room_id: room_name}
cursor = arcpy.da.SearchCursor(fc, ["RoomID", "RoomName"], "RoomName &amp;lt;&amp;gt; 'ROOM NAME'")
room_dict = dict([row for row in cursor])

# go through each wrong record an insert the right room number
# notice the different SQL query!
with arcpy.da.SearchCursor(fc, ["RoomID", "RoomName"], "RoomName = 'ROOM NAME'") as cursor:
    for row in cursor:
        try:
            name = room_dict[row[0]]
            cursor.updateRow([row[0], name])
        except KeyError:
            print("No RoomNumber found for RoomID {}".format(row[0]))&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 03 Jan 2022 08:32:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-to-calculate-a-field-from-duplicate-record/m-p/1130014#M63387</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-01-03T08:32:33Z</dc:date>
    </item>
  </channel>
</rss>

