Numpy & Pandas & Matplotilb部分API操作

Numpy

导入

import numpy as np

API

创建数组

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
np.array([10, 11, 12, 13])
# [10 11 12 13]


np.array([10, 11, 12, 13, 14 ,15]).reshape([2,3])
# [
# [10 11 12]
# [13 14 15]
# ]


np.array([[1, 2], [3, 4]])
# [
# [1 2]
# [3 4]
# ]


np.arange(4)
# [0 1 2 3]


np.arange(2, 6)
# [2 3 4 5]


np.arange(4).reshape([2,2])
# [
# [0 1]
# [2 3]
# ]


np.random.random([2,3])
# [
# [ 0.00136044 0.46854718 0.59149907]
# [ 0.75636339 0.18204628 0.53191402]
# ]
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×