当前位置:网站首页>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 !!!!
边栏推荐
- Neural network of zero basis multi map detailed map
- Web3 technology initial experience and related learning materials
- Self supervised learning and drug discovery
- pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...
- 有监督、无监督与半监督学习
- Comprehensive evaluation of free, easy-to-use and powerful open source note taking software
- 向excel中导入mysql中的数据表
- 零基礎多圖詳解圖神經網絡
- 如何高效读书学习
- Set collection usage
猜你喜欢

面试官问:能否模拟实现JS的new操作符

Xctf attack and defense world misc wage earner advanced zone

How to optimize the "message" list of IM
![[embedded foundation] serial port communication](/img/b7/18fec20e2d5fa5f226c6f8bb1e93d2.png)
[embedded foundation] serial port communication

Web3 technology initial experience and related learning materials

万字长文看懂商业智能(BI)|推荐收藏

Réseau neuronal pour la solution détaillée Multi - diagrammes de fondation zéro

药物发现综述-03-分子设计与优化

零基礎多圖詳解圖神經網絡

Using redis bitmap to realize personnel online monitoring
随机推荐
Review of drug discovery-02-prediction of molecular properties
Interview guide for data person | prepare these points to be prepared!
[elt.zip] openharmony paper Club - memory compression for data intensive applications
Machine learning notes - time series as features
Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)
I/o limit process and CPU limit process
[Yocto RM]9 - QA Error and Warning Messages
ShardingSphere-proxy-5.0.0建立mysql读写分离的连接(六)
Prometeus 2.35.0 新特性
Set collection usage
[embedded foundation] serial port communication
Capacitor
205. isomorphic string
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
Lefse analyzes the local implementation method with all installation files and details to ensure success.
Self supervised learning and drug discovery
Interface component telerik UI for WPF Getting Started Guide - how to switch custom styles using themes
力扣今日题-522. 最长特殊序列
万字长文看懂商业智能(BI)|推荐收藏
Réseau neuronal pour la solution détaillée Multi - diagrammes de fondation zéro
