NumPy: Convert a given array into a list and then convert it into a list again
NumPy: Basic Exercise-39 with Solution
Write a NumPy program to convert a given array into a list and then convert it into a list again.
Sample Solution :
Python Code :
import numpy as np a = [[1, 2], [3, 4]] x = np.array(a) a2 = x.tolist() print(a == a2)
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a NumPy program to convert a given array into bytes, and load it as array.
Next: Write a NumPy program to compute the x and y coordinates for points on a sine curve and plot the points using matplotlib.
What is the difficulty level of this exercise?
- New Content published on w3resource :
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework