Path: blob/master/Data Analytics Using Python/Numpy.ipynb
3074 views
Numerical analysis , Data prepartion
Convert some data points into arrays for numerical analysis
optimize our data rounding , mathemtheical implementation Raw data - Information- Visualization- Model Mathematical - Points- Actions: A and B supply: A and B Bigdata , Data Analytics, Machine Learning, AI(Deep learning, NLP)
Numpy:Introduction
NumPy is a Open Source Python package. It stands for Numerical Python. It is a library consisting of multidimensional array objects and a collection of routines for processing of array.
NumPy is the fundamental package for scientific computing with Python , having following important functionalities:
A powerful N-dimensional array object
A sophisticated (broadcasting) functions
Contains tools for integrating C/C++ and Fortran code
Have useful linear algebra, Fourier transform, and random number capabilities
Why NUMpy?
Mathematical and logical operations on arrays.
Efficient storage and manipulation of numerical arrays is which is fundamental in the process of data science.
NumPy arrays form the core of nearly the entire ecosystem of data science tools in Python,
Installation
Anaconda: A free distribution of Python with scientific packages. Supports Linux, Windows and Mac
pip:Most major projects upload official packages to the Python Package index. They can be installed on most operating systems using Python’s standard pip package manager.
You can install packages via one of the following Commands:
Importing Numpy & Checking Version
Bounding numpy package to local variable
The numpy package is bound to the local variable numpy. The import as syntax simply allows you to bind the import to the local variable name of your choice (usually to avoid name collisions, shorten verbose module names, or standardize access to modules with compatible APIs).
Creating Arrays
The basic ndarray is created using an array function in NumPy which creates an ndarray from any object exposing array interface, or from any method that returns an array.
Acess the members
Array Atrributes
Numpy Arrays are conveinent and fast as compared to Python Lists. 1.Shape(Elements,rowcolumn,axisrow*column)
ndim for checking dimension of array
dtype for checking data type of array
d2.size : FOR NUMBER OF ELEMENTS
Array Initilization
Array Initilization with Random numbers
In various applications( like assigning weights in Artificial Neural Networks) arrays need to be initialised randomly. for this purpose there are various predefined functions in Numpy(reshape and random)
Mathematical and stats functions
1,3,-1,8,5,6 -1,1,3,5,6,8,9
,A,A,A,B,C,D
Transpose doesn't change the number of dimensions, just reverses their order
Binary Universal Functions
Concatenating Arrays
Structured Array Creation
Broadcasting
Broadcasting is a method to overcome size of the smaller array by duplicacy so that it is the dimensionality and size as the larger array.
Why Broadcasting?
To solve the problem of arithmetic with arrays with different sizes.
[1,2,3] -[[1,2,3],[6,7,8]]
case1: First array should have 1*C order, C is num of colum in second array
case2: int, float
first array gets duplicated according to the shape of higher array
1- Lower array should be in (1*C)