# Numpy in Python – Examples of Multiplication, Array Creation

A human without brain can’t do anything, similarly python without packages are of no use. But fortunately,we have got a number of packages, libraries to handle data. One such useful library is numpy.

## NumPy

Numpy also called numerical python is one of the core libraries of python used for scientific computing of data. It has tools that makes easy to work with multi dimensional array objects and efficient computation of matrices.

## USAGE

• Data structures consume less memory.
• They have faster computation than lists.
• They have built in linear algebra operations.

## INSTALLATION

This package is not installed in python by default.Follow these steps for installation.

• Pip is a package management system used to install and manage software packages written in Python. Upgrade pip before installing python.

```pip install pip --upgrade
pip --version```
• Copy the file to C:\Python27\Scripts
• Open the terminal or command prompt  and type

```pip install numpy-1.14.5+mkl-cp27-cp27m-win32.whl
```

## 1) Array Creation

```#Input
import numpy as np
first=np.array([10,20,30,40,50])
print("Subtraction of 10", first-10)
print("Multiplication of 2", first*2)

#Output
Subtraction of 10 [0,10,20,30,40]
Multiplication of 2 [20,40,60,80,100]```

## 2) Find the largest element of Array

```#Input
a= np.array([[1, 15, 6],[14, 7, 12]])
print ("Largest element in this array:", a.max())

#Output
Largest element in this array:15```

## 3) Array Multiplication

```#Input
first= np.array([[1, 2],[3, 4]])
second= np.array([[1, 2],[3, 4]])
print("array multiplication:",first*second)

#Output
array multiplication:[[1 4]
array multiplication:[9 16]]```

## 4) To specify type of array during array creation

```#Input
arr=np.array( [ [1,2],[3,4] ],dtype=complex)

#Output
array( [1.+0.j,2.+0.j],[3.+0.j,4.+0.j] ] )
```

## Universal Functions

• sin
• cos
• exp
• sqrt

Hope this post has provided an overview of this package.What are you waiting for?Time to prove that you are a data scientist.

WANNA BECOME A PYTHON EXPLORER?:  BUILD A CHATBOT USING PYTHON

GETTING STARTED WITH PYTHON