Implementation of machine learning at Hackveda .

Deepti Bhatia
Sep 2, 2018 · 4 min read

NumPy

let us have a glimpse what numpy is :

NumPy is a mathematical library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.

Using numpy, mathematical and logical operations on arrays can be performed.

NumPy is an N-Dimensional arrat type called ‘ndarray’ . This ndarray describes the collection of items of same type .

Every element in a ndarray is an object of data type object called ‘dtype’.

FUNCTIONS used in numpy are :

  1. Identity
  2. Astype
  3. Arange
  4. Linspace
  5. Indices
  6. Data types
  7. Reshape function
  8. Converting list into an array
  9. Slicing
  10. Transpose

Firstly we will import numpy :

importing numpy

IDENTITY

In identity matrix values are printed in float .

ASTYPE

In Astype , they are used to convert its data type like integer to float and vice versa .

ARANGE

→4. (1,21,3) : it will print numbers from 1 to 20 with the gap of 3
  • In Arange , it will print values in order exluding the last number i.e it will print n-1 numbers .
  • data type of integer is changed

LINSPACE

  • In linspace , its returns number spaces . it creates matrix with intervals according to the num mentioned .

INDICES

  • In Indices , it prints the indexes of the matrix first and then the values of the matrix .

DATA TYPES

  • In data types , it will tell you the type of array using ‘dtype’ .

Format to change the type of array used .

RESHAPE

  • Reshape , it will reshape the list of elements you mentioned above into a matrix you want .
  • You just have to write elements in row form in type of matrix you need .

CONVERSION OF LIST INTO AN ARRAY

  • In this coversion of list into an array , using numpy list can simply be converted into an array .

SLICING

  • Slicing helps you to print particular part of the array .
  • You have to mention index of the items and they are separated by colan(:)
  • (0:5:2) or (2::2) → another colan or double colan represents the gap you need to print between the items .

TRANSPOSE

  • Transpose will convert the rows into columns and vice versa of the matrix mentioned above .

So this is all you need to know to use NumPy .

— — — — — — — — — — — — — — X — — — — — — — — — — — — — —

Deepti Bhatia

Written by

A B.Tech undergratuate from SRM University. Loves programming in python and machine learning.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade