"""
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.
bpd是什么 | 什么情况下需要做造影 | 王字旁的字有什么 | 什么是婚姻 | 玄乎是什么意思 |
慢性胃炎吃什么中成药 | 紫苏叶是什么 | 臀推是什么意思 | 宋美龄为什么没有孩子 | 进击的巨人真相是什么 |
白细胞低是什么原因造成的 | 超导体是什么 | 月经提前十天是什么原因 | 胃火旺吃什么好 | 牙膏洗脸有什么好处和坏处 |
爱拍马屁的动物是什么生肖 | 乳头内陷挂什么科 | 慢性浅表性胃炎是什么意思 | 肚子大是什么原因 | 手麻木是什么引起的 |
硅油是什么jingluanji.com | 喝什么饮料解酒最快zhiyanzhang.com | 陀螺是什么意思hcv9jop6ns2r.cn | 大生化是检查什么hcv8jop3ns7r.cn | 生气伤什么器官hcv8jop6ns9r.cn |
缺钾吃什么食物hcv7jop6ns2r.cn | 拉肚子吃什么药管用hcv8jop2ns2r.cn | 水痘能吃什么hcv8jop3ns1r.cn | 孕妇做无创是检查什么hcv9jop3ns4r.cn | 脚底痛什么原因hlguo.com |
枕头底下放剪刀有什么说法hcv8jop6ns2r.cn | 桑黄有什么药用价值hcv7jop9ns9r.cn | 月牙消失了是什么原因hcv9jop1ns5r.cn | 前胸疼是什么原因bysq.com | 开斋节是什么意思hcv9jop3ns0r.cn |
宫寒是什么原因引起的如何调理hcv7jop5ns1r.cn | 舌根白苔厚是什么原因hcv7jop5ns2r.cn | 孕妇喝什么牛奶对胎儿好jasonfriends.com | 什么无什么事hcv9jop4ns4r.cn | 哼哈二将是什么意思adwl56.com |