NumPyArrayToTable Issues?

1445
5
Jump to solution
06-04-2013 10:53 AM
JamesCrandall
MVP Frequent Contributor
Hopefully I am missing the obvious here, but there are issues with an output FGDB table (Default.gdb) that is the product of NumPyArrayToTable.

Has anyone had any issues with this?

There are no apparent issues or problems with the actual conversion, no errors and the output table appears just fine (I can load it into ArcMap and view the contents, even the field properties are all correct).  But for some reason, this output does not succesfully join to another layer (either programatically or manually).  The join operation does not fail or error, but no matches are found. 

However, if I export this FGDB table to a .dbf, it joins as expected.

code snip:
 ##convert final pandas DataFrame result into a numpyarray dfar = dfarrcombo.to_records() nmpyar = np.array(dfar, np.dtype([('staname', '|S25'), ('STATION', '|S25'), ('site', '|S25'),('change', '<f8'),('pastvalue', '<f8'), ('currentvalue', '<f8')]))   ##now covert the numpyarray to the gdb table in the default.gdb    arcpy.da.NumPyArrayToTable(nmpyar, r"H:\Documents\ArcGIS\Default.gdb\numpytab")   #....the rest of the code is a join operation 
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ShaunWalbridge
Esri Regular Contributor
I can confirm that it doesn't work by doing a simple join when inside of an FGDB, you'd need to perform arcpy.CopyRows_management() prior to joining. But better than that, have you seen arcpy.da.ExtendTable? That looks to do what you need in one command.

View solution in original post

0 Kudos
5 Replies
ShaunWalbridge
Esri Regular Contributor
I can confirm that it doesn't work by doing a simple join when inside of an FGDB, you'd need to perform arcpy.CopyRows_management() prior to joining. But better than that, have you seen arcpy.da.ExtendTable? That looks to do what you need in one command.
0 Kudos
JamesCrandall
MVP Frequent Contributor
I can confirm that it doesn't work by doing a simple join when inside of an FGDB, you'd need to perform arcpy.CopyRows_management() prior to joining. But better than that, have you seen arcpy.da.ExtendTable? That looks to do what you need in one command.


EDIT/Update: the CopyRows_management is a viable workaround since I am not dealing with a large amount of rows and is a much simpler approach rather than trying to include the ExtendTable method.  Still I am frustrated the NumpyArrayToTable doesn't work as expected.


Shaun,

Thanks for the input!

The ExtendTable is used to join to an existing table, so the first thing I do is build a numpy.array with a single field from a simplified DataFrame (one that contains all of the correct/necessary value for the join operation) and pass this into the arcpy.da.NumPyArrayToTable.  So this gives me an existing table to execute the ExtendTable method, using the full numpy array I wish to join with the Feature Class.

The output table is all correct.

However, when I run the final join operation to the Feature Class I get the same result (no matches found).

I'll change some things up and see if I can get this working.

Thanks again,
j
0 Kudos
ShaunWalbridge
Esri Regular Contributor
I agree, that is frustrating. I've found an existing open bug related to the issue here: http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDg0MjA4
0 Kudos
RhettZufelt
MVP Frequent Contributor
Not sure what the format of you table is, but is sounds like it is actually a FGDB table.

According to the help docs here: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005s0000002n000000


The input must be a feature layer a table view or a raster layer that has an attribute table; it cannot be a feature class or table.


Perhaps you just need to makeTableView first, then join to that?

R_
0 Kudos
JamesCrandall
MVP Frequent Contributor
Not sure what the format of you table is, but is sounds like it is actually a FGDB table.

According to the help docs here: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005s0000002n000000


Perhaps you just need to makeTableView first, then join to that?

R_


Thanks again for the tip.  Yes, I am correctly applying the join operation with both arcpy.MakeFeatureLayer_management and arcpy.MakeTableView_management.
0 Kudos