Created
February 14, 2019 16:43
-
-
Save Robofied/5bbceb0c74f9a98d10e4d0828fcc1804 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
x = np.arange(10) | |
print(x) | |
#[Output]: | |
#[0 1 2 3 4 5 6 7 8 9] | |
##It will create an array from 2 to 10(as last value is excluded) | |
y = np.arange(2, 11, dtype=np.float) | |
print(y) | |
#[Output]: | |
#[ 2. 3. 4. 5. 6. 7. 8. 9. 10.] | |
##It will create array from 2 to 2.9(3 will be excluded) as we here defined the slice of 0.1 | |
z = np.arange(2, 3, 0.1) | |
print(z) | |
#[Output]: | |
#[2. 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9] | |
##It is similar to the previous example, difference is of only slicing value. | |
z1 = np.arange(2, 3, 0.2) | |
print(z1) | |
#[Output]: | |
#[2. 2.2 2.4 2.6 2.8] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment