Python笔记 #07# NumPy 文档地址 & Subsetting 2D Arrays
文档地址:np.array()
1、<class 'numpy.ndarray'>
ndarray 表示 n 维度(n D)数组 (= n 行数组)。
2、打印 array 结构 —— np_array.shape
3、Subsetting 2D Arrays 的两种方式
不管是 arr[1][2] 还是 arr[1,2] 都是可行的,不过教程推荐第二种方式。
4、代码演示 & 一个取子集的小技巧
创建:
# Create baseball, a list of lists
baseball = [[180, 78.4],
[215, 102.7],
[210, 98.5],
[188, 75.2]] # Import numpy
import numpy as np # Create a 2D numpy array from baseball: np_baseball
np_baseball = np.array(baseball) # Print out the type of np_baseball
print(type(np_baseball)) # Print out the shape of np_baseball
print(np_baseball.shape)
打印结构:
# baseball is available as a regular list of lists # Import numpy package
import numpy as np # Create a 2D numpy array from baseball: np_baseball
np_baseball = np.array(baseball) # Print out the shape of np_baseball
print(np_baseball.shape)
小技巧:
# baseball is available as a regular list of lists # Import numpy package
import numpy as np # Create np_baseball (2 cols)
np_baseball = np.array(baseball) # Print out the 50th row of np_baseball
print(np_baseball[49,:]) # Select the entire second column of np_baseball: np_weight
np_weight = np_baseball[:,1] # Print out height of 124th player
print(np_baseball[123,0])
5、整体数学运算
# baseball is available as a regular list of lists
# updated is available as 2D numpy array # Import numpy package
import numpy as np # Create np_baseball (3 cols)
np_baseball = np.array(baseball) # Print out addition of np_baseball and updated
print(np_baseball + updated) # Create numpy array: conversion
conversion = np.array([0.0254, 0.453592, 1]) # Print out product of np_baseball and conversion
print(conversion * np_baseball)
Python笔记 #07# NumPy 文档地址 & Subsetting 2D Arrays的更多相关文章
- 使用sphinx快速为你python注释生成API文档
sphinx简介sphinx是一种基于Python的文档工具,它可以令人轻松的撰写出清晰且优美的文档,由Georg Brandl在BSD许可证下开发.新版的Python3文档就是由sphinx生成的, ...
- 使用sphinx为python注释生成docAPI文档
sphinx简介 sphinx是一种基于Python的文档工具,它可以令人轻松的撰写出清晰且优美的文档,由Georg Brandl在BSD许可证下开发. 新版的Python3文档就是由sphinx生成 ...
- python快速生成注释文档的方法
python快速生成注释文档的方法 今天将告诉大家一个简单平时只要注意的小细节,就可以轻松生成注释文档,也可以检查我们写的类方法引用名称是否重复有问题等.一看别人专业的大牛们写的文档多牛多羡慕,不用担 ...
- 找到python官方标准库文档
python中有很多标准库.我们没法记住全部标准库,但是可以在:https://docs.python.org/3/py-modindex.html 中查看标准库的索引 在python的官方文档中,如 ...
- python常用模块-配置文档模块(configparser)
python常用模块-配置文档模块(configparser) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. ConfigParser模块用于生成和修改常见配置文档,当前模块的名称 ...
- EXTJS文档地址
文档地址:http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.form.field.Field-event-change
- 【Swagger2】解决swagger文档地址请求404的问题
一.出现的问题背景 某个项目,本地启动后,访问swagger文档地址可以访问到, http://localhost:8203/doc.html.但是部署到开发环境就访问不到,报404资源找不到的问题 ...
- VMware vSphere ESXi 和 vCenter Server 5.1 文档地址
VMware vSphere ESXi 和 vCenter Server 5.1 文档地址 https://pubs.vmware.com/vsphere-51/index.jsp?top ...
- hugo官方相关文档地址
+++ date="2020-10-17" title="hugo官方相关文档地址" tags=["hugo"] categories=[& ...
随机推荐
- 关于MCU的烧录,下载与其他接口的比较(一)
今天呢,犯了一个很严重的错误,我不知道这会产生什么样的影响,但我知道,如果我以后再没有具体的了解,仔细认真地观察,认证,只会滑到无底的深渊.做技术来不得半点虚假,切记一知半解,凡事都要弄得清楚明白,认 ...
- php学习二:表达式
1. 可变变量$$ 在php中,可变变量可以用$$来表示, 代码如下: $name = "zhangSan"; $$name = "liSi"; //相当于$ ...
- 虚拟机怎么设置u盘启动
方法/步骤 1 运行你安装的虚拟机 步骤阅读 2 点击绿色的按钮,把你的虚拟机下面的系统启动. 步骤阅读 3 让你的虚拟系统处于可以按“Ctrl+Alt+Insert”重启的界面.比如我让虚拟系统 ...
- SQL 根据日期精确计算年龄
SQL 根据日期精确计算年龄 第一种: 一张人员信息表里有一人生日(Birthday)列,跟据这个列,算出该人员的年龄 datediff(year,birthday,getdate()) 例:birt ...
- MQTT的学习研究(九)基于HTTP GET MQTT 抓取消息服务端使用
官方参看文档: HTTP GET 接收主题请求协议和响应协议http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.c ...
- Android Activity与Fragment生命周期
- [Java语言] HashMap,HashSet,Hashtable,Vector,ArrayList 的关系 <转>
这么几个比较常用的但是比较容易混淆的概念同出于 java.util 包.本文仅作几个类的浅度解析. (本文基于JDK1.7,源码来自openjdk1.7.) ├── Collection │ ├── ...
- PHP内存缓存功能memcached
PHP内存缓存功能memcached: http://blog.csdn.net/fangaoxin/article/details/6223383
- Android 微信分享,分享到朋友圈与分享到好友,以及微信登陆
extends:http://www.cnblogs.com/android100/p/Android-qq.html 一.申请你的AppID http://open.weixin.qq.com/ 友 ...
- 当url作为id时的删除
API Documentation — Elasticsearch 6.3.1 documentation https://elasticsearch-py.readthedocs.io/en/mas ...