1 Star 0 Fork 0

朱康宝 / CSDN

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
reshape.py 491 Bytes
一键复制 编辑 原始数据 按行查看 历史
朱康宝 提交于 2018-12-11 16:19 . 1
# -*- coding: utf-8 -*-
"""
date: Tue Dec 11 15:33:44 2018
python: Anaconda 3.6.5
author: kanade
email: kanade@blisst.cn
"""
import numpy as np
a = np.arange(1, 9)
print('a: ', a)
b = a.reshape(2, 4)
print('b: ', b)
c = b.reshape(2, 2, 2)
print('c: ', c)
d = c.ravel()
print('d: ', d)
e = c.flatten()
print('e: ', e)
a += 10
print(a, b, c, d, e, sep='\n#')
a.shape = (2, 4)
print('a: ', a)
a.resize(2, 2, 2)
print('a: ', a)
f = b.transpose()
print(f)
Python
1
https://gitee.com/kanadeblisst/CSDN.git
git@gitee.com:kanadeblisst/CSDN.git
kanadeblisst
CSDN
CSDN
master

搜索帮助