hulkingtickets hulkingtickets - 1 year ago 134
Python Question

Converting NumPy array into Python List structure?

How do I convert a NumPy array to a Python List (for example

), and do it reasonably fast?

Answer Source

Use tolist():

import numpy as np
>>> np.array([[1,2,3],[4,5,6]]).tolist()
[[1, 2, 3], [4, 5, 6]]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download