python中pandas for遍历所有行以及其中列的值

#假设示例
teas = pd.DataFrame(columns=['name','url'])
teas.loc[0] = ['陈xx','http://xxx.htm']
teas.loc[1] = ['黄xx','http://xxx.htm']
teas.loc[2] = ['朱xx','http://xxx.htm']

#遍历行的下标以及其中列的值
for ind, row in teas.iterrows():
    print(ind)
    print(row['name'])
    print(row['url'])
上一篇:硬件设计与实践:16位CPU设计


下一篇:python-pandas库