The NumPy is used to create multidimensional array using array() method. There are many ways to create NumPy arrays. Here are some ways to create NumPy array.
1. Creating an array from a Python list:
You can create a NumPy array from a Python list using the
numpy.array()
function. For example2. Creating an array of zeros:
3. Creating an array of ones:
You can create an array of zeros using the numpy.zeros()
function. For example:
3. Creating an array of ones:
You can create an array of ones using the numpy.ones()
function. For example:
4. Creating a range of values:
You can create an array of values that are evenly spaced between a start and end value using the numpy.arange()
function. For example:
5. Creating a random array:
0 comments :
Post a Comment
Note: only a member of this blog may post a comment.