Numpy 101

Namratesh Shrivastav
Analytics Vidhya
Published in
4 min readDec 15, 2019

Numpy is a extension package to Python for multi-dimensional arrays. It is designed for scientific computation. It is also Known as array oriented computing.

Lets start with installation. Numpy installation is very simple. You can run below command to install it.

pip install numpy

The Basics

  • It’s main object is homogeneous multidimensional array.
  • Numpy axis are called axes.
  • Numpy’s array class is called ndarray.
  • Numpy array is not the same as the standard Python library class array.

You can find Notebook here.

Importing Numpy

Array Creation

  • One Dimension array
  • Two Dimension array
  • array shape
  • array dimension
  • array type
  • Creating an array using arange function

Arithmetic Operation

  • Addition
  • Subtraction
  • Multiplication
  • Divide

Logical Operations

  • OR
  • AND

Transcendental functions

  • Sin
  • log
  • Exp

Reductions

  • Sum of array elements
  • Two dimension array
  • array sum by row elements
  • array sum by column elements
  • maximum value in array
  • minimum value in array
  • index of maximum element
  • index of minimum element

Statistics

  • Mean: The mean is the average of a data set.
  • Median: The median is the middle of the set of numbers.
  • Standard deviation: The standard deviation is a measure of the amount of variation or dispersion of a set of values.

Linear Algebra

  • Transpose: The transpose of a matrix is a new matrix whose rows are the columns of the original.

Inverse matrix: The inverse of A is A-1 only when:

A × A-1 = A-1 × A = I

  • Matrix product:
  • Eigenvectors:

Suggestions are always welcome!!!

--

--