Numpy for Python

  •  python
  • >>> import numpy as np
  • >>> foo = [[1,5,9]]
  • >>> print (foo)
  • [[1, 5, 9]]
  • >>> print (np.average(foo))
  • 5.0
  • >>> a = np.array ([[1,5,9]])
  • >>> print (a)
  • [[1 5 9]]
  • >>> a
  • array([[1, 5, 9]])
  • >>> a.shape
  • (1, 3)
  • >>> a.size
  • 3
  • >>> a.ndim
  • >>> a.itemsize
  • 8
  • >>> a.dtype
  • dtype(‘int64’)
  • >>> b = np.array ([[1,2,3], [4,5,6]])
  • >>> b
  • array([[1, 2, 3],
  •        [4, 5, 6]])
  • >>> b.shape
  • (2, 3)
  • >>> b.ndim
  • 2

 

http://www.numpy.org/

 

https://docs.scipy.org/doc/numpy-dev/user/quickstart.html

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s