Skip to content

Instantly share code, notes, and snippets.

@ola-sk
Created December 31, 2019 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ola-sk/b5a3ae468a1472f8be2c74317c26db3e to your computer and use it in GitHub Desktop.
Save ola-sk/b5a3ae468a1472f8be2c74317c26db3e to your computer and use it in GitHub Desktop.
5 Python Features and Cautions
# 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