Page 198 - Touhpad Ai
P. 198

10.  Storing  clean data: Finally, the cleaned data is saved in a secure and organised location, such as a database,
                  spreadsheet, or data warehouse, for analysis, visualization, or use in decision-making systems.
              By following these steps, data scientists ensure that the data is neat, accurate, and ready for use. Clean data helps
              build better AI systems that give more reliable and useful results.


              Introduction to NumPy

              NumPy is the short form of Numerical Python. It is a fundamental library in Python that is used for performing numerical
              computation. It provides support for arrays, matrices, and a variety of mathematical functions to operate on these
              data structures efficiently. Its array-based data structures and operations execution make it very useful for various
              applications, such as data analysis, machine learning, scientific computing, etc.
              In NumPy, there are several types of arrays, which are as follows:

              u  One-dimensional  Arrays (1D Arrays): These arrays contain  elements  arranged in a single  row or column.
                  One-dimensional arrays are created using the numpy.array() function with a Python list or tuple as input.

                  Program 1: To demonstrate the use of 1D array

                 import numpy as np
                 arr_1d = np.array([1, 2, 3, 4, 5])

                 print(arr_1d)
                 Output:
                 [1 2 3 4 5]
              u  Two-dimensional  Arrays  (2D Arrays): Two-dimensional arrays are arranged in rows and columns,  forming a
                  grid-like structure. Two-dimensional arrays are created using nested lists or by reshaping a one-dimensional array.

                  Program 2: To demonstrate the use of 2D array
                 import numpy as np
                 arr_2d = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

                 print(arr_2d)
                 Output:

                 [[1 2 3]
                  [4 5 6]

                  [7 8 9]]
              u  Multi-dimensional Arrays (nD Arrays): These arrays have more than two dimensions, which helps in complex data
                  representations. Multi-dimensional arrays can be created using nested lists or by reshaping existing arrays.

                  Program 3: To demonstrate the use of nD array

                 import numpy as np
                 # Creating a 3x3x3 ndarray
                 arr_nd = np.array([[[1, 2, 3], [4, 5, 6], [7, 8, 9]],
                                   [[10, 11, 12], [13, 14, 15], [16, 17, 18]],

                                   [[19, 20, 21], [22, 23, 24], [25, 26, 27]]])
                 print(arr_nd)






                 196    Touchpad Artificial Intelligence - XI
   193   194   195   196   197   198   199   200   201   202   203