"""
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.
今天是什么好日子 | 吃什么能快速排便 | 干眼症吃什么药 | 腿水肿是什么原因引起的 | 夏季吃什么菜最好菜谱 |
什么是液化 | 机油用什么能洗掉 | 什么东西吃蟑螂 | 为什么感冒会咳嗽 | 6是什么意思 |
榴莲壳有什么用处 | 三月27号是什么星座 | 眩晕症是什么原因引起的 | 肱骨头小囊变什么意思 | 五阴是什么 |
磁共振是检查什么的 | 定坤丹什么时候吃最好 | 绝非偶然是什么意思 | 汆是什么意思 | 脚底长痣有什么说法 |
奇异果和猕猴桃有什么区别hcv9jop7ns1r.cn | 公主什么意思fenrenren.com | 相识是什么意思hcv9jop6ns8r.cn | 1207是什么星座hcv8jop0ns1r.cn | 去港澳旅游需要什么证件bfb118.com |
绿豆跟什么一起煮最好hcv8jop7ns6r.cn | 鱼不能和什么食物一起吃hcv8jop0ns2r.cn | 人生什么最重要hcv9jop4ns9r.cn | 身体发凉是什么原因hcv8jop4ns4r.cn | sherpa是什么面料yanzhenzixun.com |
肝血不足吃什么食补最快hcv9jop2ns7r.cn | pbm是什么意思hcv8jop5ns6r.cn | 生活是什么意思xinjiangjialails.com | CA是什么激素hcv8jop1ns8r.cn | 肝血不足吃什么补最快hcv9jop0ns3r.cn |
养胃喝什么hcv7jop7ns1r.cn | peek是什么材料hcv9jop1ns2r.cn | 初级中学是什么意思bysq.com | 中性粒细胞是指什么hcv8jop0ns3r.cn | 80年属猴的是什么命qingzhougame.com |