Array creation using array functions
array(data type, value list) function is used to create an array with data type and value list specified in its arguments.
np.zeros
Example :
# Python code to demonstrate the working of
# array()
# importing "array" for array operations
import array
# initializing array with array values
# initializes array with signed integers
arr = array.array('i', [1, 2, 3])
# printing original array
print ("The new created array is : ",end="")
for i in range (0,3):
print (arr[i], end=" ")
print ("\r")
Output:
The new created array is : 1 2 3 1 5
Numpy | Array Creation
In this article, we are going to explore numpy array creation technique.
Table of Content
- Array creation using List :
- Array creation using array functions
- Methods for array creation in Numpy
Contact Us