"""
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.
诡异是什么意思 | 大便隐血阳性是什么意思 | 属兔的守护神是什么菩萨 | 八带是什么 | 做梦梦到蛇是什么意思 |
1994年出生属什么 | 去医院看肛门挂什么科 | 高考成绩什么时间公布 | 鸡蛋和什么不能一起吃吗 | 血糖仪h1是什么意思 |
晒伤用什么 | 虾吃什么食物 | 胃造影和胃镜有什么区别 | 什么是占有欲 | 啤酒对身体有什么好处 |
p2大于a2什么意思 | 红对什么 | 人生座右铭是什么意思 | 小便带血是什么原因女性 | 阴历六月是什么月 |
每天什么时间锻炼最好hcv9jop6ns2r.cn | 4.11是什么星座hcv8jop7ns2r.cn | 张卫健属什么生肖jinxinzhichuang.com | 黄茶适合什么人喝hcv8jop0ns1r.cn | 云南白药的保险子是起什么作用的hcv7jop9ns7r.cn |
18k是什么金hcv9jop1ns1r.cn | 禅宗是什么意思hcv9jop6ns5r.cn | 产后第一天吃什么最好hcv8jop6ns8r.cn | 不全纵隔子宫是什么意思hcv8jop9ns4r.cn | 镇静是什么意思hcv7jop7ns4r.cn |
6月13日是什么星座hcv9jop5ns7r.cn | 什么运动使人脸部年轻hcv9jop1ns9r.cn | 奉天为什么改名沈阳hcv8jop8ns5r.cn | 才能是什么意思jasonfriends.com | 白羊男喜欢什么样的女生hcv7jop9ns5r.cn |
中午适合吃什么hcv9jop0ns9r.cn | 点痣后要注意什么hcv9jop4ns1r.cn | 什么的枝叶hcv7jop9ns5r.cn | 外阴瘙痒抹什么药hcv9jop2ns3r.cn | 玻璃五行属什么hcv9jop7ns4r.cn |