Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Glimpse Of Numpy Python
import numpy as np #create numpy one dimensiona array my_list = [1,2,3] my_arr = np.array(my_list) print 'One Dimension Numpy Array ==> ', my_arr #create a function that will make one dimesion numpy array def OneDArray(*items): my_arr = np.array(items) print 'One Dimension Array \n', my_arr #create numpy three dimension array my_mat = [[1,2,3],[4,5,6],[7,8,9]] print "Three dimesnion arry ==> \n", np.array(my_mat) #numpy arange function print 'Numpy arange function ==> ', np.arange(0,11,2) #numpy zeros print "Number zeros ==> \n", np.zeros(10) print np.zeros((4,3)) # numpy ones print "Numpy ones ==> \n" ,np.ones((4,3)) # numpy linspace print 'Numpy linspace ==> \n', np.linspace(0, 5, 10) # numpy diagonal matrix print 'Digonal Matrix ==> \n', np.eye(3) #numpy uniform random number print 'Unifor random number ==> \n', np.random.rand(3,4) # numpy non-uniform random number print 'Non-Uniform ==> \n', np.random.randn(5) #numpy random integer print 'Ranndom Integer ==> \n', np.random.randint(1,100,10) #numpy reshape arr = np.arange(25) print arr.reshape(5,5)
run
|
edit
|
history
|
help
0
Chain length calculator
Gardener
my shopping list at supermarket
Problem: rstring
Dictionary comprehension - convert to lowercase
Max
Parity in Python
axsd
cache in python
Looking at the /etc folder... :)