Python – Numpy introduction

Previous
Next

numpy:

  • Python is dynamic programming language.
  • Python doesn’t support arrays.
  • Python is a general purpose programming language to develop application.
  • ‘numpy’ is a module.
  • numpy and pandas modules make the python become an important platform in Data analysis.

Arrays:

  • Array is static(fixed size)
  • To process the information efficiently we use arrays in any programming languages(one dimensional, two dimensional and multi dimensional)

Notes:

  • ‘numpy’ module not coming with python software like other modules….
  • Third party modules need to install using pip.

pip:

  • Python packages installer.
  • It is a program
  • We need to download and install PIP first.
  • Download the file get-pip.py
  • Run the file from your system (data connection mandatory).
    • cmd/>  python  get-pip.py
  • collect the pip software through data connection and install

Installing other modules using pip:

            cmd/>  pip install <module-name>

Working with numpy module:

  • We can construct Numpy array from list.
  • We create list object initially and passing that object as an input to numpy array.
import numpy
my_list = [10,20,30,40,50]
arr = numpy.array(my_list)
print("Array is :",arr)

We can import modules with alias names:

  • alias name is a duplicate name given to ‘module’
  • we cannot use original name in that program once alias name is assigned.
import numpy as np
arr = np.array([10,20,30,40,50])
print(arr)
Previous
Next

Add Comment

Courses Enquiry Form