dictionary to numpy array code example
Example 1: python dictionary to array
dict = {"a": 1, "b": 2, "c": 3, "d": 4}
data = list(dict.items())
an_array = np.array(data)
print(an_array)
OUTPUT
[['a' '1']
['b' '2']
['c' '3']
['d' '4']]
Example 2: Disctionary to Array
// dict is Dictionary<string, Foo>
Foo[] foos = new Foo[dict.Count];
dict.Values.CopyTo(foos, 0);
// or in C# 3.0:
var foos = dict.Values.ToArray();