I have used the FeatureClassToNumPyArray tool in ArcPy, but the numpy array that is imported has only rows, with each of the fields in the original feature class as numpy.void type.

Here is a reproducible array.

b = np.array([(0,1),(1,1.5),(2,1.25),(3,1.28)],dtype=[('FID','<i4'),('Value','<f4')])

this returns a (4,) array, I want to reshape so that the array is (4,2) with the names 'FID' and 'Value', but can't quite figure out how to do this 'elegantly'.

I know that I can extract 'FID' and 'Value' as lists and then combine using np.array, but is that the best way to do it?

arr = np.array([b['FID'],b['Value']]).T
  • I believe you can use numpy.lib.recfunctions.structured_to_unstructured, but note that when creating an unstructured array all of your values will be cast to the same dtype, float32 in this case. This is true for your example using transpose above, as well.
    – mikewatt
    Aug 20, 2020 at 17:08

1 Answer 1


So I am not sure how to do it with numpy only, but if you issue the following, it works.

import pandas as pd
df = pd.DataFrame(data=arr.flatten())

If there is a better way, let me know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.