PY-59
Build Aligned Arrays from Records
Task
Write build_aligned_arrays(records, fields). Each record is a dictionary with
an id and the requested numeric fields. IDs must be unique and fields must
contain at least one unique name.
Return (ids, values, status). On success, ids is a one-dimensional NumPy
string array in record order. values is a two-dimensional float64 array
with one row per record and one column per field, in field order. Return status
"ok". An empty record list produces shapes (0,) and (0, len(fields)).
Check failures in this order: empty fields, duplicate field, duplicate record
ID, missing field, then a value that cannot be converted to float. On failure
return (None, None, reason), using "empty fields",
"duplicate field: <name>", "duplicate id: <id>",
"missing field: <id>.<field>", or "invalid value: <id>.<field>".
Example
For records [{"id":"a","x":1,"y":2}, {"id":"b","x":3,"y":4}] and
fields ["y","x"], the IDs are array(["a","b"]) and the value rows are
[[2.,1.],[4.,3.]].
Your implementation
You may import NumPy as np. Do not modify an input, print, or ask for input.