ravel()函数作用是将数组变为一维数组
numpy中矩阵的单行的表示方法是a.[1]
多行的表示方法是a.[1:3]
表示的是第二列和第三列,不包含第四列
numpy中矩阵的单列的表示方法是a.[:,1]
表示的是第二列,多列的表示方式同上
np.random.shuffle(a)可以打乱数组中行的顺序,从而达到洗牌的目的
series与array类型的不同之处为series有索引,而另一个没有;series中的数据必须是一维的,而array类型不一定 可以把series看成一个定长的有序字典,可以通过shape,index,values等得到series的属性
n1 = np.array([1, 4, 5, 67, 7, 43, ])
s1 = pd.Series(n1)
# print(s1)
'''
0 1
1 4
2 5
3 67
4 7
5 43
s2 = pd.Series(n1, index=['a', 'b', 'c', 'd', 'e','f'])
print(s2)
a 1
b 4
c 5
d 67
e 7
f 43
dtype: int32