Different Choices for Indexing 1. loc--通过行标签索引行数据 1.1 loc[1]表示索引的是第1行(index 是整数) import pandas as pd data = [[1,2,3],[4,5,6]] index = [0,1] columns=['a','b','c'] df = pd.DataFrame(data=data, index=index, columns=columns) print df.loc[1] ''' a 4 b 5 c…
先看代码: In [46]: import pandas as pd In [47]: data = [[1,2,3],[4,5,6]] In [48]: index = [0,1] In [49]: columns=['a','b','c'] In [50]: df = pd.DataFrame(data=data, index=index, columns=columns) In [51]: df Out[51]: a b c 0 1 2 3 1 4 5 6 1. loc--通过行标签索引行…