当前位置:网站首页>数组旋转
数组旋转
2022-04-23 05:47:00 【峰爷520】
import numpy as np
l = np.arange(1, 17, dtype='int16')
l.shape = (4, 4)
print(l)
print()
f1 = lambda x:np.array(list(zip(*l)))
l1 = f1(l)
print(l1)
print()
# 顺时针旋转90度
f2 = lambda x:np.array(list(zip(*l[::-1])))
l2 = f2(l)
print(l2)
print()
# 逆时针旋转90度
f3 = lambda x:np.array(list(zip(*map(lambda x:x[::-1], l))))
l3 = f3(l)
print(l3)
版权声明
本文为[峰爷520]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_41752427/article/details/81072694
边栏推荐
- MySQL groups are sorted by a field, and the first value is taken
- Introduction to virtualization features
- 基于QQwebAPI 查询昵称和头像的爬虫
- Easy to use data set and open source network comparison website
- 爬虫效率提升方法
- Basemap库绘制地图
- Calculation (enter the calculation formula to get the result)
- Sakura substring thinking
- 进程间通信的方式
- 程序设计训练
猜你喜欢
随机推荐
Flask - 中间件
Type conversion in C #
[untitled] database - limit the number of returned rows
Rust 中的 RefCell
[leetcode 401] binary Watch
队列解决约瑟夫问题
Excel打开超大csv格式数据
Use of multithreaded executors
Sakura substring thinking
Customized communication between threads (reentrantlock)
Introduction to virtualization features
Export of data
LockSupport. Park and unpark, wait and notify
The onnx model of yolov5 removes the transfer layer
Object转Json差异之Gson fastJson jackson 修改字段名
[leetcode169] most elements
基于QQwebAPI 查询昵称和头像的爬虫
自动控制原理知识点整合归纳(韩敏版)
POI and easyexcel exercises
Addition, deletion, query and modification of data