Answers for "how to create a record array from lists in python"

0

how to create a record array from lists in python

import numpy as np
a1=np.array([1,2,3,4])
a2=np.array(['Red','Green','White','Orange'])
a3=np.array([12.20,15,20,40])
result= np.core.records.fromarrays([a1, a2, a3],names='a,b,c')
print(result[0]) # (1, 'Red', 12.2) 
print(result[1]) # (2, 'Green', 15.0) 
print(result[2]) # (3, 'White', 20.0)
Posted by: Guest on June-13-2021

Code answers related to "how to create a record array from lists in python"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language