Numpy的基本概念
来源:https://www.numpy.org/devdocs/user/quickstart.html
轴:即维度
eg.
- [1, 2, 1],有一个轴
- [[ 1, 0, 0],[ 0, 1, 2]] ,有两个轴,第一个个轴的长度是2,第二个轴的长度是3
ndarray:numpy的数组类,也叫数组
常用的ndarray属性有:
ndarray.ndim
the number of axes (dimensions) of the array.
ndarray.shape
the dimensions of the array. This is a tuple of integers indicating the size of the array in each dimension. For a matrix with n rows and m columns, shape will be (n,m). The length of the shape tuple is therefore the number of axes, ndim.
ndarray.size
the total number of elements of the array. This is equal to the product of the elements of shape.
ndarray.dtype
an object describing the type of the elements in the array. One can create or specify dtype’s using standard Python types. Additionally NumPy provides types of its own. numpy.int32, numpy.int16, and numpy.float64 are some examples.
ndarray.itemsize
the size in bytes of each element of the array. For example, an array of elements of type float64 has itemsize 8 (=64/8), while one of type complex32 has itemsize 4 (=32/8). It is equivalent to ndarray.dtype.itemsize.
ndarray.data
the buffer containing the actual elements of the array. Normally, we won’t need to use this attribute because we will access the elements in an array using indexing facilities.
Numpy的基本概念的更多相关文章
- Python数据分析 | Numpy与1维数组操作
作者:韩信子@ShowMeAI 教程地址:http://www.showmeai.tech/tutorials/33 本文地址:http://www.showmeai.tech/article-det ...
- 想学Python?这里有一个最全面的职位分析
Python从2015年开始,一直处于火爆的趋势,目前Python工程师超越Java.Web前端等岗位,起薪在15K左右,目前不管是小公司还是知名大公司都在热招中. 当然,每个城市对岗位的需求也不尽相 ...
- 阿里重磅开源首款自研科学计算引擎Mars,揭秘超大规模科学计算
日前,阿里巴巴正式对外发布了分布式科学计算引擎 Mars 的开源代码地址,开发者们可以在pypi上自主下载安装,或在Github上获取源代码并参与开发. 此前,早在2018年9月的杭州云栖大会上,阿里 ...
- Tensor基本理论
Tensor基本理论 深度学习框架使用Tensor来表示数据,在神经网络中传递的数据均为Tensor. Tensor可以将其理解为多维数组,其可以具有任意多的维度,不同Tensor可以有不同的数据类型 ...
- Tensor基础实践
Tensor基础实践 飞桨(PaddlePaddle,以下简称Paddle)和其他深度学习框架一样,使用Tensor来表示数据,在神经网络中传递的数据均为Tensor. Tensor可以将其理解为多维 ...
- Numpy中重要的广播概念
Numpy中重要的广播概念 广播:简单理解为用于不同大小数组的二元通用函数(加.减.乘等)的一组规则 广播的规则: 如果两个数组的维度数dim不相同,那么小维度数组的形状将会在左边补1 如果shape ...
- Numpy常用概念-对象的副本和视图、向量化、广播机制
一.引言 在我们操作数组的时候,返回的是新数组还是原数组的链接,我们就需要了解对象副本和视图的区别. 向量化和广播是numpy内部实现的基础. 二.对象副本和视图 我们应该注意到,在操作数组的时候返回 ...
- NumPy学习1:基本概念
NumPy的数组类被称作 ndarray .通常被称作数组.注意numpy.array和标准Python库类array.array并不相同,后者只处理一维数组和提供少量功能.更多重要ndarray对象 ...
- 利用Python进行数据分析(5) NumPy基础: ndarray索引和切片
概念理解 索引即通过一个无符号整数值获取数组里的值. 切片即对数组里某个片段的描述. 一维数组 一维数组的索引 一维数组的索引和Python列表的功能类似: 一维数组的切片 一维数组的切片语法格式为a ...
随机推荐
- HDU 1757 A Simple Math Problem (矩阵快速幂)
题目 A Simple Math Problem 解析 矩阵快速幂模板题 构造矩阵 \[\begin{bmatrix}a_0&a_1&a_2&a_3&a_4&a ...
- Docker proxy
Method One: mkdir /etc/systemd/system/docker.service.dvim /etc/systemd/system/docker.service.d/http- ...
- 简易RPC
暴露服务: package com.saiarea; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; impo ...
- (转)学习HTML5 Canvas这一篇文章就够了
作者:做人要厚道2013 原文:https://blog.csdn.net/u012468376/article/details/73350998
- dgraph实现基本操作
dgraph实现基本操作 简单介绍 dgraph 是一个分布式图数据库 mutate 为一个突变, 一般认为添加数据或者是删除数据为一个突变 query 为一个查询 golang实现dgraph的基本 ...
- web技术应用分享
https://www.helloweba.com/nav.html Helloweba为广大前端开发者收录了常用实用的前端资源工具,方便大家学习和查阅. https://www.hello ...
- Django 中的static文件的设置
STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ('article',os.path.jo ...
- Python模拟弹道轨迹
http://www.itongji.cn/cms/article/articledetails?articleid=5029 最近美国把萨德系统部署到韩国,一时心血来潮就用python模拟最简单的弹 ...
- PageRank算法初探
1. PageRank的由来和发展历史 0x1:源自搜索引擎的需求 Google早已成为全球最成功的互联网搜索引擎,在Google出现之前,曾出现过许多通用或专业领域搜索引擎.Google最终能击败所 ...
- react native 安卓home返回键页面刷新
import { withNavigationFocus } from 'react-navigation'; class Warngreete extends React.Component { c ...