当前位置:网站首页>Detailed explanation of numpy multidimensional array ndarray
Detailed explanation of numpy multidimensional array ndarray
2022-07-30 07:50:00 【sunset stained ramp】
Numpy Ndarray object
An important feature of Numpy is its N-dimensional array object ndarray, which is a series of homogeneous data sets, starting with 0 subscripts to index elements in the set.Multidimensional array similar to C++ vector.
The following are the characteristics of Ndarray (different from python's list)
The ndarray object is a multidimensional array used to store elements of the same type.(For example: all are float, str, or int, etc., but they must be of the same type.)
Each element in ndarray has the same storage area in memory
Based on the above characteristics, ndarray consists of the following contents:
1) A pointer to data (a piece of data in memory or a memory-mapped file).
2) The data type or dtype, describing the grid of fixed-size values in the array.
3) A tuple representing the shape of the array and a tuple representing the size of each dimension.
4) A stride, where the integer refers to the number of bytes that need to be "crossed" in order to advance to the next element in the current dimension.
To create an ndarray array, just call the numpy array function:
numpy.array(object, dtype=None,copy=True,order=None,subok=false,ndmin=0)
| Name | Description |
|---|---|
| object | Array or nested sequence |
| dtype | Data structure of array elements, optional |
| copy | Whether the object needs to be copied, optional |
| order | The style of creating an array, C is the row direction, F is the column direction, A is any direction |
| subbok | default returns an array consistent with the base class |
| ndmin | Specify the minimum dimension of the generated array |
The above is the usage of multi-dimensional arrays in python's numpy module. It is necessary to test its usage through Liezi.As follows:
1: Create a 1D array
2:Create a two-dimensional array
3: Test the ndmin parameter
4: Test parameter dtype parameter
Summary: narray multidimensional array is a very important part of numpy module.Manipulating narray arrays inherits python's operations.It converts to and from python's list, str, float, etc.
边栏推荐
- Interactively compose graphs in GraphScope based on the JupyterLab plugin
- 多线程基础(概念,创建,中断)
- Test Development Engineer Growth Diary 017 - The Life Cycle of a Bug
- MySql connecting to the server remotely
- 软件测试_01
- prometheus-basic_auth加密配置
- 测试开发工程师成长日记018 - 测试面试必备题记录(持续更新)
- MySQL主从复制配置搭建,一步到位
- 从 Vertex 到 Subgraph 再到 PIE: 并行图计算编程模型概览
- (GGG)JWT
猜你喜欢

网络协议01 - 基础概念

Multithreading basics (multithreaded memory, security, communication, thread pools and blocking queues)

libgrape-lite on GPUs: GPU helps accelerate graph analysis tasks

GNNLab:基于空间共享思想设计的新型 GNN 系统

多线程进阶(CountDownLatch,死锁,线程安全集合类)

Mastering JESD204B (1) – Debugging of AD6676

About memcache kernel, so one of the most popular

Network Protocol 01 - Basic Concepts

测试开发工程师成长日记018 - 测试面试必备题记录(持续更新)

Install MySQL under Linux (centos7)
随机推荐
Alamofire源码分析 - POST请求
删除openstack中的僵尸实例
DHCP原理与配置
Test and Development Engineer Growth Diary 009 - Environment Pai Pai Station: Development Environment, Test Environment, Production Environment, UAT Environment, Simulation Environment
舒尔补(schur completement)
Network Protocol 04 - Physical and Data Link Layers
how to use xilinx's FFT ip
Network Protocol 03 - Routing and NAT
Test Development Engineer Growth Diary 007 - Bug Priority Definition and Filling Specifications
网络协议03 - 路由和NAT
矩阵的行列式的计算及其源码
测试开发工程师成长日记009 - 环境排排站:开发环境、测试环境、生产环境、UAT环境、仿真环境
远程连接服务器的MySql
Alamofire source code analysis - POST request
GNNLab: A Novel GNN System Based on Spatial Sharing Ideas
MongoDB-查询
多线程进阶(锁策略,自旋+CAS,Synchronized,JUC,信号量)
测试开发工程师成长日记008 - 浅谈一些Bug/用例管理平台/协作平台
Test Development Engineer Growth Diary 001 - Some Introduction to Agile Testing, CI/CD/CT, DecOps
Graph analysis like NetworkX with GraphScope