2] # 选择第二个索引处的元素
3
>>> b[1,2] # 选择第1行第2列的元素(相当于b[1][2])
1.5 2 3 6.0 456
获取子集
>>> a[0:2] # 选择索引0和1...的项
array([1, 2])
>>> b[0:2,1] # 选择第1列中第0行和第1行中的项目
array([ 2., 5.])
>>> b[:1] # 选择第0行中的所有项目,等价于b[0:1...,6.,1.5])
>>> b[[1, 0, 1, 0]][:,[0,1,2,0]] # 选择矩阵的行和列的子集
array([[4.,5.,6.,4.],
[1.5,2.,3.,1.5...Stack: 将数据的列索引转换为行索引(列索引可以简单理解为列名)
Unstack: 将数据的行索引转换为列索引
>>> stacked = df5.stack()
>>> stacked.unstack...(lambda x: not x%5) # 选择特定的元素
# Where
>>> s.where(s > 0) # 满足条件的子集的数据
# Query
>>> df6.query('second