How to use 'np array to list' in Python

Every line of 'np array to list' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
211def _np_to_list(elem):
212 """Returns list from list, tuple or ndarray."""
213 if isinstance(elem, list):
214 return elem
215 elif isinstance(elem, tuple):
216 return list(elem)
217 elif isinstance(elem, np.ndarray):
218 return list(elem)
219 else:
220 raise ValueError(
221 'Input elements of a sequence should be either a numpy array, a '
222 'python list or tuple. Got {}'.format(type(elem)))
17def to_nd_float_array(list_obj):
18 return np.array(list_obj, dtype=np.float32)

Related snippets