Created
December 31, 2019 21:48
-
-
Save ola-sk/b5a3ae468a1472f8be2c74317c26db3e to your computer and use it in GitHub Desktop.
5 Python Features and Cautions
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
# one dimensional example | |
import numpy as np | |
# list of data | |
data1 = [[11, 22], [33, 44], [55, 66]] | |
# convert datatype of data1 to numpy.ndarray | |
data2 = np.array(data1) | |
type(data2) | |
'''Out: | |
<class 'numpy.ndarray'> | |
''' | |
print(data2[:]) | |
''' Out: | |
array([[11, 22], | |
[33, 44], | |
[55, 66]]) | |
''' | |
# Multi-dimentional slicing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment