pandas可以通过loc和iloc来筛选元素,ix不推荐使用
data = {'AAA':[4,5,6,7], 'BBB':[10,20,30,40], 'CCC':[100,50,-30, -50]}
df = pd.DataFrame(data=data, index=['foo','bar','boo','kar']);df
Purely integer-location based indexing for selection by position.
.iloc[]
is primarily integer position based (from 0
to length-1
of the axis), but may also be used with a boolean array.
#筛选第一行到第二行的数据,注意区间左闭右开
df.iloc[1:3]
Access a group of rows and columns by label(s) or a boolean array.