This is a continuation of an earlier learning on numpy arrays.
A structured array is created from the elements of a list - and thereafter populated with values(not shown below).
>>> o = ['x','y','z']
>>> import numpy as np
>>> b = np.zeros((len(o),), dtype=[(i,object) for i in o])
>>> b
array([(0, 0, 0, 0, 0), (0, 0, 0, 0, 0), (0, 0, 0, 0, 0)],
dtype=[('x', '|O4'), ('y', '|O4'), ('z', '|O4')])
The populated array looks as below:
x y z
x 0 1 0
y 1 0 1,5
z 0 1,5 0
1.How do we add new vertices to the above?
2.Once the vertices have been added,what is the cleanest process to add the following array to the structured array(NOTE:not all vertices in this array are new):
d e y
d 0 '1,2' 0
e '1,2' 0 '1'
f 0 '1' 0
The expected output(please bear with me):
x y z d e f
x 0 1 0 0 0 0
y 1 0 1,5 0 1 0
z 0 1,5 0 0 0 0
d 0 0 0 0 1,2 0
e 0 1 0 1,2 0 0
f 0 0 0 0 1 0