当前位置:网站首页>6.23 warehouse operation on Thursday
6.23 warehouse operation on Thursday
2022-07-03 05:18:00 【Good good good】
6.23 Thursday warehouse operation
List of articles
Numpy practice
Exercise one : Create from 0 To 9 One dimensional array of numbers
import numpy as np
arr = np.arange(10)
print(arr)

Exercise 2 : Create an element all for True Of 3×3 Array
import numpy as np
arr = np.full([3, 3], True, dtype=np.bool)
print(arr)

Practice three : Create a 2D array , Where the boundary value is 1, The rest are 0
import numpy as np
Z = np.ones((10,10))
Z[1:-1,1:-1] = 0
print(Z)

Pandas practice
Exercise one : Write matrix multiplication using list derivation
The general matrix multiplication is based on the formula , It can be written by a triple loop , Please rewrite it in the form of list derivation .
M1 = np.random.rand(2,3)
M2 = np.random.rand(3,4)
res = np.empty((M1.shape[0],M2.shape[1]))
for i in range(M1.shape[0]):
for j in range(M2.shape[1]):
item = 0
for k in range(M1.shape[1]):
item += M1[i][k] * M2[k][j]
res[i][j] = item
(np.abs(([email protected] - res) < 1e-15)).all() # Eliminate numerical errors
The form of list derivation
import numpy as np
M1 = np.random.rand(2,3)
M2 = np.random.rand(3,4)
res = [[sum([M1[i][k] * M2[k][j] for k in range(M1.shape[1])]) for j in range(M2.shape[1])] for i in range(M1.shape[0])]
(np.abs(([email protected] - res) < 1e-15)).all()

Matplotlib practice
Exercise one : Two drawing interfaces
matplotlib Provides two of the most commonly used drawing interfaces
- Create explicitly figure and axes, Call the drawing method above , Also known as OO Pattern (object-oriented style)
- rely on pyplot Automatically create figure and axes, And draw
Using the first drawing interface , That's true :
x = np.linspace(0, 2, 100)
fig, ax = plt.subplots()
ax.plot(x, x, label='linear')
ax.plot(x, x**2, label='quadratic')
ax.plot(x, x**3, label='cubic')
ax.set_xlabel('x label')
ax.set_ylabel('y label')
ax.set_title("Simple Plot")
ax.legend()

The second drawing interface
x = np.linspace(0, 2, 100)
plt.plot(x, x, label='linear')
plt.plot(x, x**2, label='quadratic')
plt.plot(x, x**3, label='cubic')
plt.xlabel('x label')
plt.ylabel('y label')
plt.title("Simple Plot")
plt.legend()

边栏推荐
- 聊聊如何利用p6spy进行sql监控
- [research materials] 2022q1 game preferred casual game distribution circular - Download attached
- 获取并监控远程服务器日志
- Win10 install pytullet and test
- 1106 lowest price in supply chain (25 points)
- MySQL master-slave configuration
- JQ style, element operation, effect, filtering method and transformation, event object
- Basic knowledge of reflection (detailed explanation)
- [batch dos-cmd command - summary and summary] - CMD window setting and operation command - close CMD window and exit CMD environment (exit, exit /b, goto: EOF)
- Introduction to redis and explanation of data types
猜你喜欢

Deep embedding and alignment of Google | protein sequences

Webrtc native M96 version opening trip -- a reading code download and compilation (Ninja GN depot_tools)

Use posture of sudo right raising vulnerability in actual combat (cve-2021-3156)

Go practice - gorilla / handlers used by gorilla web Toolkit

Botu uses peek and poke for IO mapping

leetcode452. Detonate the balloon with the minimum number of arrows

联想R7000显卡的拆卸与安装

谷歌 | 蛋白序列的深度嵌入和比对

JS scope

Differences among bio, NiO and AIO
随机推荐
Common interview questions of microservice
Pytorch through load_ state_ Dict load weight
(perfect solution) how to set the position of Matplotlib legend freely
[set theory] relationship properties (common relationship properties | relationship properties examples | relationship operation properties)
Redis expiration elimination mechanism
JS string and array methods
Redis 入門和數據類型講解
Rust基础入门之(基本类型)
"Pthread.h" not found problem encountered in compiling GCC
XML配置文件
How to connect the network: Chapter 1 CSDN creation punch in
Introduction to deep learning (II) -- univariate linear regression
Go practice - gorilla / handlers used by gorilla web Toolkit
Go practice -- generate and read QR codes in golang (skip2 / go QRcode and boombuilder / barcode)
Bluebridge cup real topic 2020 palindrome date simulation construction provincial competition
Go practice -- gorilla/rpc (gorilla/rpc/json) used by gorilla web Toolkit
[batch dos-cmd command - summary and summary] - CMD window setting and operation command - close CMD window and exit CMD environment (exit, exit /b, goto: EOF)
Deploy crawl detection network using tensorrt (I)
6.23星期四库作业
JQ style, element operation, effect, filtering method and transformation, event object