当前位置:网站首页>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.
边栏推荐
- 【Untitled】
- GAIA-IR: Parallelized Graph Query Engine on GraphScope
- A New Paradigm for Distributed Deep Learning Programming: Global Tensor
- 快速开发 GraphScope 图分析应用
- 网络协议03 - 路由和NAT
- STL源码剖析:bound friend template friend代码测试和理解
- The concept and testing method of black box testing
- 测试开发工程师成长日记018 - 测试面试必备题记录(持续更新)
- GCD timer
- 牛客:删除公共字符
猜你喜欢
多线程进阶(CountDownLatch,死锁,线程安全集合类)
引导过程与服务控制
Advanced multi-threading (CountDownLatch, deadlock, thread-safe collection class)
空间顶点到直线的距离计算及其源码
Graph analysis like NetworkX with GraphScope
Bull: remove common characters
Vineyard: An open source distributed in-memory data management framework
DHCP原理与配置
02-Use of Cycript
libgrape-lite on GPUs:GPU助力加速图分析任务
随机推荐
测试开发工程师成长日记007 - Bug的优先级定义及填写规范
RAID磁盘阵列
使用 Grafana 的 Redis Data Source 插件监控 Redis
瀑布流(自定义布局实现)
测试开发工程师成长日记018 - 测试面试必备题记录(持续更新)
多线程进阶(CountDownLatch,死锁,线程安全集合类)
Mastering JESD204B (3) – Debugging of AD6676
CTO说不建议我使用SELECT * ,这是为什么?
Waterfall flow (custom layout implementation)
Multithreading basics (multithreaded memory, security, communication, thread pools and blocking queues)
Application of graph computing in network security analysis
测试开发工程师成长日记002 - 从0开始做接口自动化
大厂年薪50w+招聘具有测试平台开发能力的测试工程师
空间直线到平面上的交点的计算证明及其源码
prometheus监控minio
Linux(centos7)下安装MySQL
使用 Helm 部署 GraphScope
MySql connecting to the server remotely
kubernetes搭建SonarQube进行代码扫描
作为测试leader,考察求职者的几个方面