Convert structured array with various numeric data types to regular array

后端 未结 4 1273
天命终不由人
天命终不由人 2021-01-06 11:24

Suppose I have a NumPy structured array with various numeric datatypes. As a basic example,

my_data = np.array( [(17, 182.1),  (19, 175.6)],  dtype=\'i2,f4\         


        
4条回答
  •  广开言路
    2021-01-06 12:12

    Here's one way (assuming my_data is a one-dimensional structured array):

    In [26]: my_data
    Out[26]: 
    array([(17, 182.10000610351562), (19, 175.60000610351562)], 
          dtype=[('f0', '

提交回复
热议问题