学习groupby感觉就像是excel里面的数据透视表
time_tag = "timeframe" #将这个改成原始表格中的时段特征的列名
stationseq = pd.read_csv("0803final.txt")[['STATIONSEQNUM',"TIMEHEADWAY",'tag',time_tag]]
station = stationseq[stationseq['tag'] == 2]
grouped_df =pd.DataFrame(station.groupby(['timeframe','STATIONSEQNUM'])['tag'].count())
print(grouped_df)
result = grouped_df[grouped_df.groupby('timeframe')['tag'].rank(ascending = False)==1]
print(result)