Welcome to the official documentation for Numpy, the fundamental package for scientific computing with Python.
Overview
Numpy is the foundation for many high-level tools in Python for data analysis, including Pandas, SciPy, and Scikit-learn. It provides support for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays.
Installation
To install Numpy, you can use pip
:
pip install numpy
Getting Started
Basic Usage
Numpy arrays are fundamental to Numpy and are used in almost every program involving Numpy. They can be seen as a table of data with rows and columns or as a multi-dimensional container of items.
Here's a simple example:
import numpy as np
# Create a 1D array
a = np.array([1, 2, 3])
# Create a 2D array
b = np.array([[1, 2], [3, 4]])
Operations
Numpy provides a wide range of mathematical functions to operate on arrays.
- Element-wise operations:
c = a + b
- Broadcasting:
d = a * b[:, np.newaxis]
Further Reading
For more detailed information, check out the Numpy official documentation.