ITERROWS:仅打印行值

时间:2017-11-10 15:25:27

标签: python python-3.x pandas

当我们使用时:

for index, row in df.iterrows():
    # prints tuple (column, value)
    print(row)

    # prints column name (left side)
    print (row.index)

我们如何只打印值(元组的右侧?)

1 个答案:

答案 0 :(得分:2)

for index, row in df.iterrows():
    # prints tuple (column, value)
    print(row.values)

    # prints column name (left side)
    print (row.index.values)