am_dot_com

IA 20211027

Oct 27th, 2021 (edited)
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #intro_numpy
  2. import numpy as np
  3.  
  4. a1 = np.array([1,2,3])
  5. print (a1)
  6. print (type(a1)) #numpy.ndarray
  7.  
  8. a2 = np.array([
  9. [1,2,3],
  10. [4,5,6],
  11. [7,8,9]
  12. ])
  13. print (a2)
  14. print (type(a2)) #numpy.darray
  15.  
  16. progArit3 = np.arange(
  17. 1, #min
  18. 50+1,#max, exclusive
  19. 3 #step
  20. )
  21. print(progArit3)
  22.  
  23. #floats
  24. linSpace12 = np.linspace(
  25. 1, #min
  26. 50, #max
  27. 120 #how many elements
  28. )
  29. print (linSpace12)
  30.  
  31. #powers of 10
  32. logSpace1 = np.logspace(
  33. 2,#start-exponent (start @ base^2)
  34. 16,#end-exponent (end base^5)
  35. num=50, #size of col
  36. base=2
  37. )
  38. print (logSpace1)
  39.  
  40. print (np.var(linSpace12))
Advertisement
Add Comment
Please, Sign In to add comment