【发布时间】:2017-10-12 12:41:20
【问题描述】:
我有一个如下所示的数据框。
customers ...
Date
2006-01-03 98 ...
2006-01-04 120 ...
2006-01-05 103 ...
2006-01-06 95 ...
2006-01-09 103 ...
我想获取客户数量超过 100 的行并打印出来。
for x in range(len(df)):
if df['customers'].iloc[x] > 100:
print(df['customers'].iloc[x])
但我不知道如何打印出满足条件的行的日期(索引)。我的目标是像这样打印出来:
2006-01-04
120
2006-01-05
103
2006-01-09
103
【问题讨论】: