Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 151 - 2615_KEC
P. 151

    Specialised functionality: Libraries  provide  domain-specific  tools  that  aren't included  in
                       Python's standard library.
                       Efficiency: Many libraries are optimised for performance and use C/C++ extensions under the

                       hood.
                       Community standards: Using established libraries makes code more maintainable and easier
                       for others to understand.

                     IMPORTING LIBRARIES

                     There are different ways to import libraries in Python, which are as follows:

                        Basic import: Import the entire library and access its contents with dot notation. For example,

                       import numpy
                        Import with alias: Use an alias for convenience or to avoid name conflicts. For example,

                       import numpy as np
                        Import specific functions/classes: Import only what you need, making them directly available.
                       For example,

                       from numpy import array, arange, linspace, sqrt
                        Import everything: Import all names directly into the current namespace. For example,

                       from numpy import *
                        Submodule imports: Import specific submodules from large libraries. For example,

                       import numpy.random as npr
                       import numpy.linalg as la

                               NUMPY (NUMERICAL PYTHON)

                     NumPy  is  a powerful open-source  scientific  package  that  stands  for 'Numerical  Python'.
                     It uses mathematical and logical operations for handling large datasets through powerful data

                     structure-n-dimensional arrays that also speeds up data processing. NumPy is the first step in
                     learning, to become a Python data scientist in the future. It can also be easily interfaced with
                     other Python packages and provides tools for integrating with other programming languages like
                     C, C++ etc.

                     If you are using basic Python installed through https://www.python.org website then the NumPy
                     package is not included by default. You need to install it separately.

                     NumPy can be installed by typing following command:

                     pip install numpy
                     Once it is installed, it can be readily used in any Python code by using import keyword as shown
                     below:

                     Numpy can also be imported into the Jupyter Notebook by using the given statement:

                                                                                   NumPy-Creation, Selection & Operation  149

| 146 147 148 149 150 151 152 153 154 155 156 |