当前位置:网站首页>Numpy——2. Shape of array
Numpy——2. Shape of array
2022-07-07 19:14:00 【Hair will grow again without it】
The shape of the array
View the shape of the array
a.shape()
You can judge how many dimensions the array is by the number of returned values
Modify the shape of the array
a.reshape(x, y)
Return value but not modified a Arraya.flatten()
Turn the array directly into one dimension
>
The calculation of array
Calculation of arrays and numbers
Broadcast mechanism
When calculating an array and a number , Apply this number to each element of the array , In fact, this number is expanded into the dimension of the sum array , Row number , An array with the same number of columns , Then do the operation on the corresponding element
Arrays and the calculation of arrays
identical shape Array of The calculation of , Directly add, subtract, multiply and divide the corresponding elements
Different shape Array of The calculation of , If it's two-dimensional , Rows and columns must have the same dimension , The other dimension is 1. If it is 3 One dimension minus one two dimension , Also look at rows and columns
It is also a broadcasting mechanism , It will expand the small one dimension of the row or column to the large one
example A two-dimensional
example The three dimensional
边栏推荐
猜你喜欢
完整的电商系统
The top of slashdata developer tool is up to you!!!
面试唯品会实习测试岗、抖音实习测试岗【真实投稿】
Reuse of data validation framework Apache bval
前首富,沉迷种田
Will low code help enterprises' digital transformation make programmers unemployed?
基于图像和激光的多模态点云融合与视觉定位
抢占周杰伦
Comparison and selection of kubernetes Devops CD Tools
Simple configuration of single arm routing and layer 3 switching
随机推荐
2022-07-04 matlab读取视频帧并保存
Draw squares with Obama (Lua)
Embedded interview questions (algorithm part)
Micro service remote debug, nocalhost + rainbow micro service development second bullet
如何选择合适的自动化测试工具?
Flipping game (enumeration)
IP netns command (memo)
App capture of charles+postern
RISCV64
10 schemes to ensure interface data security
Basic concepts and properties of binary tree
Flipping Game(枚举)
【Base64笔记】「建议收藏」
从39个kaggle竞赛中总结出来的图像分割的Tips和Tricks
来了!GaussDB(for Cassandra)新特性亮相
PTA 1101 B是A的多少倍
A hodgepodge of ICER knowledge points (attached with a large number of topics, which are constantly being updated)
Desci: is decentralized science the new trend of Web3.0?
Redis的发布与订阅
LeetCode 497(C#)