【发布时间】:2020-07-08 19:33:55
【问题描述】:
我正在使用一个数据框,该数据框有一列时间(格式为 YYYY/MM/DD/HH/MM/SS)和另一列风速 - 在几个月的过程中每秒收集一次。
我希望我的代码生成列表,将所有风速值分组到它们被拍摄的那一天。
day_number = 0
for index, row in df.iterrows():
#NOTE: I only run the if clause on the first 78450 rows of data
#because I get an error from the last line of code
if index < 78450:
if time[index][0:10] == time[index+1][0:10]:
#[here I want to generate lists grouping my wind speed values]
else:
day_number += 1
有没有办法从单个 for 循环生成多个列表?或者是否有特定的 Pandas 函数可以做到这一点?
谢谢
【问题讨论】: