<?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 Hi everyone, in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130481#M10131</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As part of a larger python program, I am trying to join a table and a feature class, both residing in a gdb.&amp;nbsp; My code for the join is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inFeatures = wksp + "\[name of file, which is pretty long]"&lt;/P&gt;&lt;P&gt;featField = "GenericID"&lt;/P&gt;&lt;P&gt;joinTable = wksp + "\joinGIDcounts"&lt;/P&gt;&lt;P&gt;tableField = "GID"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print ("joining tables...")&lt;/P&gt;&lt;P&gt;arcpy.JoinField_management (inFeatures, featField, joinTable, tableField)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print ("end script")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have these issues:&lt;/P&gt;&lt;P&gt;1. the program never gets to the last print statement, it just keeps running&lt;/P&gt;&lt;P&gt;2. when I close the program, it says "your program is still running, do you want to kill it?", and I say yes.&lt;/P&gt;&lt;P&gt;3. I check the inFeatures table in ArcMap and the fields from joinTable are there and joined correctly&lt;/P&gt;&lt;P&gt;4. I try to delete the fields, because this is only a test of the first 200 records of a table with a few thousand records&lt;/P&gt;&lt;P&gt;5. I get a message saying cannot delete fields because of an existing lock.&amp;nbsp; But I killed the Python program when I closed it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know why I am stuck here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Sep 2020 02:48:46 GMT</pubDate>
    <dc:creator>MaryBandziukas</dc:creator>
    <dc:date>2020-09-17T02:48:46Z</dc:date>
    <item>
      <title>Hi everyone,</title>
      <link>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130481#M10131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As part of a larger python program, I am trying to join a table and a feature class, both residing in a gdb.&amp;nbsp; My code for the join is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inFeatures = wksp + "\[name of file, which is pretty long]"&lt;/P&gt;&lt;P&gt;featField = "GenericID"&lt;/P&gt;&lt;P&gt;joinTable = wksp + "\joinGIDcounts"&lt;/P&gt;&lt;P&gt;tableField = "GID"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print ("joining tables...")&lt;/P&gt;&lt;P&gt;arcpy.JoinField_management (inFeatures, featField, joinTable, tableField)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print ("end script")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have these issues:&lt;/P&gt;&lt;P&gt;1. the program never gets to the last print statement, it just keeps running&lt;/P&gt;&lt;P&gt;2. when I close the program, it says "your program is still running, do you want to kill it?", and I say yes.&lt;/P&gt;&lt;P&gt;3. I check the inFeatures table in ArcMap and the fields from joinTable are there and joined correctly&lt;/P&gt;&lt;P&gt;4. I try to delete the fields, because this is only a test of the first 200 records of a table with a few thousand records&lt;/P&gt;&lt;P&gt;5. I get a message saying cannot delete fields because of an existing lock.&amp;nbsp; But I killed the Python program when I closed it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know why I am stuck here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 02:48:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130481#M10131</guid>
      <dc:creator>MaryBandziukas</dc:creator>
      <dc:date>2020-09-17T02:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Hi everyone,</title>
      <link>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130482#M10132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem may be in the names of the workspace and the files... especially if they aren't raw encoded and/or have spaces or other unsavory characters.&lt;/P&gt;&lt;P&gt;Make sure you "remove joins" prior to messing around with a standalone script.&lt;/P&gt;&lt;P&gt;I would also give this tool a run to see if anything is amiss&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/validate-join.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/validate-join.htm"&gt;Validate Join (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then try to see if you can do the join through the interface PRIOR to worrying about whether it will run in a script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 04:11:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130482#M10132</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-09-17T04:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Hi everyone,</title>
      <link>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130483#M10133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Dan, for your reply.&amp;nbsp; You may have hit it on the head; my path does indeed have spaces and a period, because whoever set up the directories numbered them, such as:&amp;nbsp; 3. Geometric Design\Official Drawings ...&amp;nbsp; I have no way around this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The join does work fine in ArcMap, which is how I program - do it first in ArcMap, then write the script.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the Join Validation Report gives me a cardinality warning that there are non-distinct matching records, which I am aware of and which doesn't cause errors in the join when done in ArcMap, but maybe in Python I need to present a join table with only unique records.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is probably pretty obvious that I don't write many programs - I am just discovering that there are nuanced differences between how ArcMap and Python handle things.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interestingly, the whole beginning of the script works OK using this wksp - spaces, period and all - i.e. read the feature class, place ID numbers into a python list, use .count to find out how many of each ID number there are and put the counts into a second list, zip the lists into a list of tuples, convert the tuples into a nympy structured array and convert the array to a table.&amp;nbsp; Python will confirm that the table exists, continuing to use this same workspace.&amp;nbsp; It's just the last step, the join, that hangs up.&amp;nbsp; Which leads me to believe the non-unique records might be more of an issue than the path.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I noticed another interesting oddity too:&amp;nbsp; when I first converted the array to a table, I started the table name with upper case letters.&amp;nbsp; When I did an arcpy.ListTables(), it found other tables with lower case names, but not my new one, or another one I had previously created in ArcMap also beginning with upper case letters.&amp;nbsp; So I changed the name and took out the upper case characters, and then arcpy found it.&amp;nbsp; I have a habit of prefacing my gdb tables with GDBT_ (geodatabase table) so I can differentiate them from imported spreadsheets with the same name.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And finally, my feature class filename begins with BK_ (uppercase), and arcpy.ListFeatureClasses() does find it.&amp;nbsp; So it's not simply a matter of upper/lower case.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case, I think I'll try paring my join table to unique records first, and if necessary I may try moving everything to another temporary path without spaces etc, to see if it works there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 16:11:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130483#M10133</guid>
      <dc:creator>MaryBandziukas</dc:creator>
      <dc:date>2020-09-17T16:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Hi everyone,</title>
      <link>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130484#M10134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are going from structured arrays to tables then to joins, why not&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/data-access/extendtable.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/data-access/extendtable.htm"&gt;ExtendTable—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Saves a load of problems.&lt;/P&gt;&lt;P&gt;You will have to deal with the cardinality issue in any event.&amp;nbsp; Just make sure that the field you are joining to has unique values and you have an equivalent field in your numpy array&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 17:50:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130484#M10134</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-09-17T17:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Hi everyone,</title>
      <link>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130485#M10135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so many choices&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ExtendTable joins an array to a table, I need to join a table (or array) to a feature class.&amp;nbsp; Would it still work?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, the feature class does not have unique values in its join field; if I provide only unique values in the join table, I will have a N:1 join, which should work fine.&amp;nbsp; e.g. if I have 3 records with the same GenericID (the join field) in the feature class, they will each be matched to the same record in the join table, which has two fields - GID (genericID - the join field) and countGID, which in this case would have the value of 3, and which tells me that this particular segment joined to 3 "valid intersection nodes" as a result of a spatial join.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I noticed that the inputs into arcpy.JoinField_management are supposed to be table views, and I didn't convert my files, just input them as feature class and table.&amp;nbsp; Perhaps that also needs attention.&amp;nbsp; I did it because I wanted to see if it would work (and then forgot that part).&amp;nbsp; Maybe not&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your continuing attention!&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;The whole purpose of the script is to avoid having to export to and process in excel and then re-import the spreadsheet back into the gdb.&amp;nbsp; I hope I can get it; it will make file management a bit easier&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 19:17:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130485#M10135</guid>
      <dc:creator>MaryBandziukas</dc:creator>
      <dc:date>2020-09-17T19:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Hi everyone,</title>
      <link>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130486#M10136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;a table coming from an array can be joined to a featureclass since it has a table.&lt;/P&gt;&lt;P&gt;I skip excel (and Pandas for that matter) and just use numpy&amp;nbsp;and its ndarray and chararray handle number and text processing&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 19:25:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130486#M10136</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-09-17T19:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hi everyone,</title>
      <link>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130487#M10137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, thanks.&amp;nbsp; I am completely new to numpy and pandas.&amp;nbsp; I'm trying to move away from excel.&amp;nbsp; This is my first question posted to GeoNet, so thanks for showing me what a great resource it is.&amp;nbsp; Looking forward to learning what numpy can do (and maybe Pandas)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 23:00:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hi-everyone/m-p/130487#M10137</guid>
      <dc:creator>MaryBandziukas</dc:creator>
      <dc:date>2020-09-17T23:00:24Z</dc:date>
    </item>
  </channel>
</rss>

