loc:可以索引到最后的index
iloc:无法索引到最后的index,同python中的List
例子如下:
test = pd.DataFrame({'a': list(range(10))})
#输出[0, 1]
test.iloc[:2]
#输出[0, 1, 2]
test.loc[:2]
loc:可以索引到最后的index
iloc:无法索引到最后的index,同python中的List
例子如下:
test = pd.DataFrame({'a': list(range(10))})
#输出[0, 1]
test.iloc[:2]
#输出[0, 1, 2]
test.loc[:2]