python dictionary to array

Solutions on MaxInterview for python dictionary to array by the best coders in the world

showing results for - "python dictionary to array"
Serena
17 May 2019
1dict = {"a": 1, "b": 2, "c": 3, "d": 4}
2
3data = list(dict.items())
4an_array = np.array(data)
5
6print(an_array)
7OUTPUT
8[['a' '1']
9 ['b' '2']
10 ['c' '3']
11 ['d' '4']]