我有一个如下所示的数据帧。你知道吗
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
使用循环,可以通过测向指数[十]
df[df['customer']>;100]将完成此工作。。。 尽管你可以在stackoverflow上找到许多类似的答案
考虑使用^{} :
要获得指定的确切输出格式,请迭代
query()
结果:相关问题 更多 >
编程相关推荐