Created
February 14, 2019 16:33
-
-
Save Robofied/a38800a90b5390a72b17fa952cdef08e to your computer and use it in GitHub Desktop.
Numpy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
## Creating array using list | |
x = np.array([2,3,1,0]) | |
print(x) | |
#[Output]: | |
#[2 3 1 0] | |
## Creating array using the mixture of list and tuple | |
x = np.array([[1,2.0],[0,0],(1+1j,3.)]) | |
print(x) | |
#[Output]: | |
#[[1.+0.j 2.+0.j] | |
# [0.+0.j 0.+0.j] | |
# [1.+1.j 3.+0.j]] | |
## With the help of asarray function | |
x = np.asarray([[1,2.0],[0,0],(1+1j,3.)]) | |
print(x) | |
#[Output]: | |
#[[1.+0.j 2.+0.j] | |
# [0.+0.j 0.+0.j] | |
# [1.+1.j 3.+0.j]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment