JupyterLab is a web-based ui for Project Jupyter that allows you to work with text editors, terminals, custom components and Jupyter notebooks.
Jupyter notebooks are documents that combine live runnable code with data, Markdown, equations (LaTeX), images, interactive visualizations and other rich output.
Some of the key features of Jupyter Lab are: Text, code consoles and terminals - A scratchpad fo running code interactively, this can be linked to a notebook kernel as the computation log.
Kernel-backed documents - This allows for code in text files (Markdown, Python, R, LaTeX, etc.) to run interactively in a Jupyter kernel.
Notebook cells - Can output and mirror cells into their own tab, and side by side with a notebook. Has simple dashboards and interactive controls.
Multiple views - Has many different views for documents and different editors. Enables live editing of documents with a live preview.
NumPy is a Python library that is widely used for numerical computing. It provides support for large, multi-dimensional arrays and matrices, as well as a variety of mathematical functions that can be applied to these arrays. Some of the key functionalities of NumPy include:
Multi-dimensional array support: NumPy provides a powerful N-dimensional array object that can hold data of any type, including numbers, strings, and other Python objects. This allows for efficient computation on large datasets.
Mathematical operations: NumPy provides a wide range of mathematical functions for operations such as trigonometry, algebra, and statistics. These functions operate on arrays of data, making it easy to perform complex mathematical operations on large datasets.
Indexing and slicing: NumPy provides a powerful indexing and slicing mechanism that allows for efficient access to specific elements of arrays. This can be used to extract specific subsets of data from large arrays, or to manipulate data in various ways.
With these features and its powerful array object and mathematical functions make it easy to perform complex computations on large datasets, and its linear algebra functions can be used for a wide range of scientific computing tasks.
NumPy arrays are like lists in Python, but they have some special properties that make them more efficient for numerical computing.
NumPy arrays can be multi-dimensional, meaning that they can have multiple rows and columns. The basic structure of a NumPy array is a collection of elements of the same data type.
To create a NumPy array, you can use the numpy.array() function. Here’s an example:
import numpy as np
# Create a 1-dimensional NumPy array
my_array = np.array([1, 2, 3, 4, 5])
# Create a 2-dimensional NumPy array
my_2d_array = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
To manipulate NumPy arrays, you can use indexing and slicing just like you would with lists. Here are some examples:
import numpy as np
# Create a 1-dimensional NumPy array
my_array = np.array([1, 2, 3, 4, 5])
# Access an element in the array
print(my_array[0]) # Output: 1
# Access a slice of the array
print(my_array[1:4]) # Output: [2, 3, 4]
# Assign a new value to an element in the array
my_array[2] = 10
print(my_array) # Output: [1, 2, 10, 4, 5]
NumPy also provides many built-in functions for performing operations on arrays. Here are some examples:
import numpy as np
# Create a 1-dimensional NumPy array
my_array = np.array([1, 2, 3, 4, 5])
# Add 5 to each element of the array
new_array = my_array + 5
print(new_array) # Output: [6, 7, 8, 9, 10]
# Multiply each element of the array by 2
new_array = my_array * 2
print(new_array) # Output: [2, 4, 6, 8, 10]
# Compute the sum of all elements in the array
total = np.sum(my_array)
print(total) # Output: 15
References