标签:data nbsp das div 标签 and code log port
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) df.loc[1] ‘‘‘ a 4 b 5 c 6 ‘‘‘ df a b c 0 1 2 3 1 4 5 6
1.2 loc[‘d’]表示索引的是第’d’行(index 是字符)
data = [[1,2,3],[4,5,6]] index = [‘d‘,‘e‘] columns=[‘a‘,‘b‘,‘c‘] df = pd.DataFrame(data=data, index=index, columns=columns) df.loc[‘d‘] ‘‘‘ a 1 b 2 c 3 ‘‘‘ df a b c d 1 2 3 e 4 5 6
标签:data nbsp das div 标签 and code log port
原文地址:http://www.cnblogs.com/ttrrpp/p/6891298.html