Introduction to Numpy Python

Introduction to Numpy Python

    python libraries

    python library is a collection of functions and methods that allow you to perform many actions without writing your code.

    NumPy

    • Numpy stands for numerical python and is the core library for numeric and scientific computing.
    • it consists of multidimensional array objects and a collection of routines for processing those arrays

    How to use NumPy ??

    • import NumPy as np

    single-dimensional array

    • One dimensional array contains elements only in one dimension. In other words, the shape of the NumPy array should contain only one value in the tuple.
    • One dimensional array contains elements only in one dimension. In other words, the shape of the NumPy array should contain only one value in the tuple. Let us see how to create 1 dimensional NumPy arrays.

               

          










      multidimensional-array

    • The multidimensional array is the two dimensional array. It has the more than one row and the columns of the elements.
    • A NumPy array is a homogeneous block of data organized in a multidimensional finite grid. All elements of the array share the same data type, also called dtype.
    • An ndarray is a (usually fixed-size) multidimensional container of items of the same type and size. The number of dimensions and items in an array is defined by its shape, which is a tuple of N non-negative integers that specify the sizes of each dimension. The type of items in the array is specified by a separate data-type object (dtype), one of which is associated with each ndarray.
    • As with other container objects in Python, the contents of an ndarray can be accessed and modified by indexing or slicing the array (using, for example, N integers), and via the methods and attributes of the ndarray.
    • Different ndarrays can share the same data, so that changes made in one ndarray may be visible in another. That is, an ndarray can be a “view” to another ndarray, and the data it is referring to is taken care of by the “base” ndarray. ndarrays can also be views to memory owned by Python strings or objects implementing the buffer or array interfaces.


        

     NumPy with zeros

    • it is an initialization method to store zeros in array.
    • we can store zero values in single dimensional array and multi dimensional array.
          


    NumPy initialization with the same number
    • it is an initializaion technique used to store number with same number or data .
    • with this we can store data of same number in single and multi dimensional array.

     

         








    initialization NumPy array with a range
    • it is a intitialization technique used to store a range of values .
    • we can store n number of value in the given range in single and multi dimensional array.









    NumPy-shapes
    • it is a function used to show size of a array and its dimension.
    • we can able to know the size of array by shape function.
    • by using shape function we can change the dimension according to our need.
        
        
     
       

    pls follow us for more posts on python libraries 

    Post a Comment

    Previous Post Next Post