Page 208 - AI Ver 3.0 Class 11
P. 208
Array:
[[25. 36. 25.]
[75. 86. 35.]]
Program 38: To create a numpy array by taking values from the user through np.empty()
import numpy as np
# Get the dimensions of the array from the user
rows = int(input("Enter the number of rows: "))
cols = int(input("Enter the number of columns: "))
# Create an empty array
array = np.empty((rows, cols))
# Get the values from the user and fill the array
for i in range(rows):
for j in range(cols):
value = float(input(f"Enter the value for element ({i},{j}): "))
array[i, j] = value
# Print the array
print("Array:")
print(array)
Output:
Enter the number of rows: 2
Enter the number of columns: 3
Enter the value for element (0,0): 25
Enter the value for element (0,1): 36
Enter the value for element (0,2): 25
Enter the value for element (1,0): 75
Enter the value for element (1,1): 86
Enter the value for element (1,2): 35
Array:
[[25. 36. 25.]
[75. 86. 35.]]
Introduction to Pandas
Pandas is a popular Python library widely used for data manipulation and analysis. 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.
206 Touchpad Artificial Intelligence (Ver. 3.0)-XI

