Skip to content

Instantly share code, notes, and snippets.

@elmaedesistemas
Created January 9, 2020 11:01
Show Gist options
  • Save elmaedesistemas/4bf57cf519f886a00184be690a586374 to your computer and use it in GitHub Desktop.
Save elmaedesistemas/4bf57cf519f886a00184be690a586374 to your computer and use it in GitHub Desktop.
Introduction Python Numpy - Arrays
Display the source blob
Display the rendered blob
Raw
#Python Numpy - Arrays
import numpy as np
numbers = [1,2,3,4]
array = np.array(numbers)
array
np.arange(0,50)
np.arange(0,50,5)
np.zeros(5)
np.ones(5)
np.ones((3,3))
np.linspace(0,40,10)
np.random.randint(0,100)
array = np.random.randint(0,100,10)
array
array.max()
array.argmax()
array.reshape(5,2)
array
array = array.reshape(5,2)
array
array[4,1]
filter = array > 30
array2 = array[filter]
array2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment