reading-notes

What are the key features and benefits of Jupyter Lab, and how does it differ from Jupyter Notebook?

What are the main functionalities provided by the NumPy library, and how can it be useful in Python programming, particularly for scientific computing and data manipulation tasks?

Functionalities and benefits of the NumPy library:

Explain the basic structure and properties of NumPy arrays, and provide examples of how to create, manipulate, and perform operations on them.

Basic structure and properties of NumPy arrays:

import numpy as np

# Creating an array
arr1 = np.array([1, 2, 3, 4, 5])  # 1D array
arr2 = np.array([[1, 2, 3], [4, 5, 6]])  # 2D array

# Accessing elements and shape
print(arr1[0])  # Output: 1
print(arr2[1, 2])  # Output: 6
print(arr1.shape)  # Output: (5,)
print(arr2.shape)  # Output: (2, 3)

# Reshaping an array
arr3 = np.reshape(arr1, (5, 1))
print(arr3.shape)  # Output: (5, 1)

# Element-wise operations
result = arr1 + arr2
print(result)  # Output: [[2 4 6] [5 7 9]]

</code>