for time in ['08','09','10','11','12','13','14','15','16']:
count = 0
for line in open(r'the path of txt','r'):
if line[4:6] == time and line[-2] == '0':count +=1
print('%s:00:00 - %s:59:59 : %d'%(time,time,count))
#说明:the path of txt 要改为文本文件的路径
#注意:文本的最后一行要回车一下(换行),不然最后一行的内容不会被读取
这就是个分组统计,pandas读出源数据,对时间中的小时分组统计