"""
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.
风什么浪什么 | 夜明珠是什么东西 | 风起云涌是什么生肖 | 什么是纯净物 | 皮肤溃烂化脓用什么药 |
小便黄是什么原因引起的 | 半夜吃东西有什么危害 | 风邪是什么 | 斋醮是什么意思 | 半夜饿是什么原因 |
8月开什么花 | 打喷嚏漏尿是什么原因 | 盐碱地适合种什么农作物 | 毒瘾为什么那么难戒 | 狗摇尾巴是什么意思 |
亨特综合症是什么病 | 体育生能报什么专业 | 翻墙是什么 | 什么叫磨玻璃结节 | 尿路感染吃什么药效果最好 |
兔子能吃什么水果sscsqa.com | 月光族是什么意思啊wuhaiwuya.com | 一拃是什么意思hcv9jop6ns0r.cn | 大姨妈很多血块是什么原因hcv8jop0ns6r.cn | 康字五行属什么hcv8jop6ns3r.cn |
返利是什么意思hcv8jop8ns8r.cn | 什么的花纹hcv9jop4ns7r.cn | onlycook是什么牌子hcv8jop5ns8r.cn | 寻麻疹看什么科qingzhougame.com | 大便带血是什么原因hcv9jop1ns4r.cn |
冰岛为什么不让随便去bjcbxg.com | 刘备儿子叫什么hcv8jop1ns4r.cn | 下体瘙痒用什么药hcv8jop8ns5r.cn | 梦见嫂子是什么意思ff14chat.com | 安娜苏香水什么档次hcv8jop8ns5r.cn |
咽炎吃什么aiwuzhiyu.com | 规格是指什么hcv7jop6ns2r.cn | 异烟肼是什么药hcv8jop5ns3r.cn | anti什么意思hcv8jop0ns4r.cn | 衣原体感染是什么意思hcv8jop4ns6r.cn |