"""
To try the examples in the browser:
1. Type code in the input cell and press
Shift + Enter to execute
2. Or copy paste the code, and click on
the "Run" button in the toolbar
"""
# The standard way to import NumPy:
import numpy as np
# Create a 2-D array, set every second element in
# some rows and find max per row:
x = np.arange(15, dtype=np.int64).reshape(3, 5)
x[1:, ::2] = -99
x
# array([[ 0, 1, 2, 3, 4],
# [-99, 6, -99, 8, -99],
# [-99, 11, -99, 13, -99]])
x.max(axis=1)
# array([ 4, 8, 13])
# Generate normally distributed random numbers:
rng = np.random.default_rng()
samples = rng.normal(size=2500)
samples
Nearly every scientist working in Python draws on the power of NumPy.
NumPy brings the computational power of languages like C and Fortran to Python, a language much easier to learn and use. With this power comes simplicity: a solution in NumPy is often clear and elegant.
NumPy's API is the starting point when libraries are written to exploit innovative hardware, create specialized array types, or add capabilities beyond what NumPy provides.
Array Library | Capabilities & Application areas | |
![]() | Dask | Distributed arrays and advanced parallelism for analytics, enabling performance at scale. |
![]() | CuPy | NumPy-compatible array library for GPU-accelerated computing with Python. |
![]() | JAX | Composable transformations of NumPy programs: differentiate, vectorize, just-in-time compilation to GPU/TPU. |
![]() | Xarray | Labeled, indexed multi-dimensional arrays for advanced analytics and visualization. |
![]() | Sparse | NumPy-compatible sparse array library that integrates with Dask and SciPy's sparse linear algebra. |
PyTorch | Deep learning framework that accelerates the path from research prototyping to production deployment. | |
TensorFlow | An end-to-end platform for machine learning to easily build and deploy ML powered applications. | |
![]() | Arrow | A cross-language development platform for columnar in-memory data and analytics. |
![]() | xtensor | Multi-dimensional arrays with broadcasting and lazy computing for numerical analysis. |
Awkward Array | Manipulate JSON-like data with NumPy-like idioms. | |
![]() | uarray | Python backend system that decouples API from implementation; unumpy provides a NumPy API. |
![]() | tensorly | Tensor learning, algebra and backends to seamlessly use NumPy, PyTorch, TensorFlow or CuPy. |
NumPy lies at the core of a rich ecosystem of data science libraries. A typical exploratory data science workflow might look like:
NumPy forms the basis of powerful machine learning libraries like scikit-learn and SciPy. As machine learning grows, so does the list of libraries built on NumPy. TensorFlow’s deep learning capabilities have broad applications — among them speech and image recognition, text-based applications, time-series analysis, and video detection. PyTorch, another deep learning library, is popular among researchers in computer vision and natural language processing.
Statistical techniques called ensemble methods such as binning, bagging, stacking, and boosting are among the ML algorithms implemented by tools such as XGBoost, LightGBM, and CatBoost — one of the fastest inference engines. Yellowbrick and Eli5 offer machine learning visualizations.
NumPy is an essential component in the burgeoning Python visualization landscape, which includes Matplotlib, Seaborn, Plotly, Altair, Bokeh, Holoviz, Vispy, Napari, and PyVista, to name a few.
NumPy’s accelerated processing of large arrays allows researchers to visualize datasets far larger than native Python could handle.
虎头蛇尾是什么生肖 | 玉米吃了有什么好处 | 山竹不能和什么水果一起吃 | 过敏擦什么药膏好得快 | 糖尿病能喝什么饮料 |
维c不能和什么一起吃 | 修缮是什么意思 | 梦见炒菜是什么意思 | 可吸收线是什么颜色 | 风水宝地是什么生肖 |
高光是什么意思 | 脸发烫是什么原因 | 瑶字五行属什么 | 二氧化碳是什么气体 | 宫颈囊肿是什么 |
胃火喝什么茶降火 | 独一无二是什么生肖 | 嗓子哑吃什么药 | 什么是偏爱 | 狗生小狗前有什么征兆 |
十指纤纤尽夸巧是什么生肖hcv8jop3ns0r.cn | 来月经量少吃什么可以增加月经量hcv8jop0ns5r.cn | 什么值得买官网hcv8jop1ns4r.cn | 6.8什么星座1949doufunao.com | 30岁用什么眼霜比较好hcv9jop5ns5r.cn |
花生什么时候成熟hcv9jop1ns1r.cn | 肝实质回声不均匀是什么意思hcv9jop7ns3r.cn | leu是什么氨基酸hcv8jop4ns9r.cn | 米果念什么hcv8jop8ns8r.cn | 手臂长斑是什么原因hcv8jop0ns2r.cn |
禹五行属什么hcv8jop8ns4r.cn | 湿疹抹什么药膏hcv7jop5ns4r.cn | 二代试管是什么意思hcv9jop0ns2r.cn | 焦虑症吃什么中成药能根治hcv8jop1ns3r.cn | 眼睛红用什么眼药水hcv9jop1ns2r.cn |
香港是什么时候回归的hcv9jop1ns7r.cn | dc是什么hcv9jop8ns1r.cn | 啤酒酵母是什么huizhijixie.com | 总胆红素高是什么原因hcv7jop9ns5r.cn | 鸡肠炎用什么药效果好xinmaowt.com |