Skip to content

Commit 123f8d8

Browse files
committed
commit
1 parent bab1db7 commit 123f8d8

File tree

2 files changed

+42
-21
lines changed

2 files changed

+42
-21
lines changed

.idea/workspace.xml

Lines changed: 16 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python科学计算基础/Numpy数据存取与常用函数.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,29 @@
7272
# np.load(fname)
7373
# • fname : 文件名,以.npy为扩展名,压缩扩展名为.npz
7474

75-
a = np.arange(100).reshape(5, 10, 2)
76-
np.save('a.npy', a)
75+
# a = np.arange(100).reshape(5, 10, 2)
76+
# np.save('a.npy', a)
77+
# b = np.load('a.npy')
78+
# print(b)
79+
80+
"""
81+
numpy的随机数函数
82+
"""
83+
84+
# rand(d0,d1,..,dn) 根据d0‐dn创建随机数数组,浮点数,[0,1),均匀分布
85+
# randn(d0,d1,..,dn) 根据d0‐dn创建随机数数组,标准正态分布
86+
# randint(low[,high,shape]) 根据shape创建随机整数或整数数组,范围是[low, high)
87+
# seed(s) 随机数种子,s是给定的种子值
88+
89+
# a = np.random.rand(3, 4, 5)
90+
# print(a)
91+
# b = np.random.randn(3, 4, 5)
92+
# print(b)
93+
# c = np.random.randint(100, 800,(3, 4, 2))
94+
# print(c)
95+
96+
# shuffle(a) 根据数组a的第1轴进行随排列,改变数组x
97+
# permutation(a) 根据数组a的第1轴产生一个新的乱序数组,不改变数组x
98+
# choice(a[,size,replace,p])
99+
# 从一维数组a中以概率p抽取元素,形成size形状新数组
100+
# replace表示是否可以重用元素,默认为False

0 commit comments

Comments
 (0)