I am trying to get acquainted with numpy and point feature classes in ArcGIS and I started with what I thought was an simple example.
I am reading in a single part point feature class (contains fields named: X, Y and YR) via FeatureClassToNumPyArray. I am interested in finding the 'max' value within a given field using numpy.
A snippet of my code is below:
array = arcpy.da.FeatureClassToNumPyArray(inputFC, ["X", "Y", "YR"])
print array
It prints:
[(2531050.0, 7431830.0, 2018.0) (2531050.0, 7431810.0, 2018.0)
(2531050.0, 7431850.0, 2018.0) (2531050.0, 7431930.0, 2018.0)
(2531050.0, 7431890.0, 2018.0) (2531050.0, 7431870.0, 2018.0)
(2531050.0, 7431910.0, 2018.0) (2531050.0, 7431950.0, 2018.0)
(2531050.0, 7431970.0, 2018.0) (2531050.0, 7432030.0, 2018.0)
(2531070.0, 7428230.0, 2018.0)]
A slight change in the code attempts to get the max for each column by specifying axis = 0:
array = arcpy.da.FeatureClassToNumPyArray(inputFC, ["X", "Y", "YR"])
print numpy.amax(array, axis = 0)
However the script output is:
File "work5_EFI_sum.py", line 102, in <module>
doSummary()
File "work5_EFI_sum.py", line 20, in doSummary
print numpy.amax(array, axis = 0)
File "C:\Python27\ArcGIS10.6\lib\site-packages\numpy\core\fromnumeric.py", line 2140, in amax
out=out, keepdims=keepdims)
File "C:\Python27\ArcGIS10.6\lib\site-packages\numpy\core\_methods.py", line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
TypeError: cannot perform reduce with flexible type
Any idea on what's going on?