What is the difference between applying list() on a numpy array vs. calling tolist()?
I was checking the types of both output
.tolist() appears to convert all of the values recursively to python primitives (list), whereas list creates a python list from an iterable. Since the numpy array is an array of arrays, list(...) creates a list of arrays
You can think of list as a function that looks like this:
# Not the actually implementation, just for demo purposes
def list(iterable):
newlist = []
for obj in iter(iterable):
newlist.append(obj)
return newlist