python dict to numpy structured array

前端 未结 5 498
星月不相逢
星月不相逢 2020-12-02 12:04

I have a dictionary that I need to convert to a NumPy structured array. I\'m using the arcpy function NumPyArraytoTable, so a NumPy structured array is the only data format

5条回答
  •  执念已碎
    2020-12-02 13:11

    Similarly to the approved answer. If you want to create an array from dictionary keys:

    np.array( tuple(dict.keys()) )
    

    If you want to create an array from dictionary values:

    np.array( tuple(dict.values()) )
    

提交回复
热议问题