Convert NumPy array to Python list - Stack Overflow
stackoverflow.com › questions › 1966207Dec 27, 2009 · tolist () works fine even if encountered a nested array, say a pandas DataFrame; my_list = [0,1,2,3,4,5,4,3,2,1,0] my_dt = pd.DataFrame (my_list) new_list = [i [0] for i in my_dt.values.tolist ()] print (type (my_list),type (my_dt),type (new_list)) Share Follow answered Apr 26, 2018 at 21:16 Shivid 1,195 1 20 35 Add a comment 1 Another option
Python | Convert an array to an ordinary list with the same items
https://www.geeksforgeeks.org/python-convert-array-ordinary-list-items30.12.2017 · Input :array ('k', [45, 23, 56, 12]) Output : [45, 23, 56, 12] Explanation: the array with elements [45, 23, 56, 12] are converted into list with the same elements. Approach to the …
Convert NumPy array to Python list - Stack Overflow
https://stackoverflow.com › questionsUse tolist() : >>> import numpy as np >>> np.array([[1,2,3],[4,5,6]]).tolist() [[1, 2, 3], [4, 5, 6]]. Note that this converts the values from whatever ...