当前位置:网站首页>Numpy----np. reshape()
Numpy----np. reshape()
2022-06-28 02:07:00 【Rookies should love learning】
Learning goals :
master np.reshape() function
When it comes to redefining shapes , Pay attention to some grammar :
import numpy as np
a = np.arange(1,17).reshape(4,4) # Definition 4 That's ok 4 Column 1 To 16 Array of
print(" The original array is :\n",a)
# Will array a Redefined as (2,8) Array of
# Method 1
b1 = a.reshape(2,8)
print("b1 As the result of the :\n",b1)
# Method 2
b2 = np.reshape(a,(2,8))
print("b2 As the result of the :\n",b2)
of np.reshape(A,(-1)) Several situations of
‘ See code for details ’
print("***********************")
import numpy as np
z = np.arange(1,17).reshape(4,4)
print(" Turn elements into a column ( A two-dimensional )")
print(np.reshape(z,(-1,1)))
print(" Turn the element into a line ( A two-dimensional )")
print(np.reshape(z,(1,-1)))
print(" Change an element into a string ( A one-dimensional )")
print(np.reshape(z,(-1)))
print("***********************")

It is mainly to flatten the given array into the form we need !!!!
边栏推荐
- 【sylixos】i2c设备驱动创建和使用
- Numpy----np.tile()函数解析
- Voice network VQA: make the user's subjective experience of unknown video quality in real-time interaction known
- Appium自动化测试基础— 补充:App的包名(appPackage)和启动名(appActivity)
- 向excel中导入mysql中的数据表
- Web3 技术初体验以及相关学习资料
- Solon 1.8.3 release, cloud native microservice development framework
- Machine learning notes - time series as features
- Scala 基础 (三):运算符和流程控制
- Solve storage problems? WMS warehouse management system solution
猜你喜欢

评价——秩和比综合评价

一张图弄懂 MIT,BSD,Apache几种开源协议之间的区别

Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)

Drug interaction prediction based on learning size adaptive molecular substructure

Import the data table in MySQL into Excel

Implementation of timed tasks in laravel framework

Database query optimization: master-slave read-write separation and common problems

TI AM3352/54/59 工业核心板硬件说明书

Shardingsphere-proxy-5.0.0 establish MySQL read / write separation connection (6)

1382. 将二叉搜索树变平衡-常规方法
随机推荐
How fiddle uses agents
Ten MySQL locks, one article will give you full analysis
Li Kou today's question -522 Longest special sequence
Modular development
Prometeus 2.35.0 新特性
Adobe Premiere Basics - general operations for editing material files (offline files, replacing materials, material labels and grouping, material enabling, convenient adjustment of opacity, project pa
Numpy----np.reshape()
[Yocto RM]3 - Yocto Project Releases and the Stable Release Process
Adobe Premiere基础-常用的视频特效(裁剪,黑白,剪辑速度,镜像,镜头光晕)(十五)
[Yocto RM]3 - Yocto Project Releases and the Stable Release Process
Drug interaction prediction based on learning size adaptive molecular substructure
什么是数字化?什么是数字化转型?为什么企业选择数字化转型?
力扣今日题-522. 最长特殊序列
万字长文看懂商业智能(BI)|推荐收藏
Can you open an account for stock trading in flush? Is it safe?
解决ionic4 使用hammerjs手势 press 事件,页面无法滚动问题
style中的scoped属性和lang属性
零基礎多圖詳解圖神經網絡
MapReduce elementary programming practice
模块化开发
