Page 199 - Touhpad Ai
P. 199
Output:
[[[ 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]]]
In NumPy, arrays are homogeneous, which means all elements in an array must be of the same data type, for example,
integers, floats, etc.
You can install NumPy using pip. For installing NumPy, you need to open your terminal or command prompt and run
the following command:
pip install numpy
NumPy Library in Artificial Intelligence
Let us understand why and where we can use the NumPy library in Artificial Intelligence with the help of an example.
Suppose, you have a dataset containing daily temperature readings from weather stations across different cities.
You can utilise NumPy arrays to efficiently manage and analyse this data.
With NumPy's array operations, you can easily perform the following tasks:
u Calculating the average temperature for each city over the recorded days.
u Finding the total temperature recorded for each day across all cities.
u Determining the overall average temperature across all cities and days.
u Identifying the highest and lowest temperatures recorded.
NumPy's array operations streamline these computations that enables you to handle large datasets with ease. This
makes NumPy an indispensable tool for processing and analysing data in different fields.
Introduction to Pandas
Pandas is a popular Python library widely used for data manipulation and analysis. The Python library Pandas is
commonly used for cleaning data is Pandas. The name “Pandas” has a reference to both “Panel Data”, and “Python
Data Analysis”. It provides data structures and functions that make it easy to work with structured data, such as
tabular data (for example Excel spreadsheets or SQL tables). Pandas is built on top of NumPy, another Python library
for numerical computing, and it extends its functionality by providing high-level data structures and powerful tools for
data manipulation, cleaning, filtering, grouping, merging, etc. Its adaptability and user-friendly interface make this an
essential tool for data analysts, scientists, and engineers who are working on structured data.
Theoretical and Practical Aspects of Data Processing 197

