擅长:python、mysql、java
<p>我会从一天一天的分组开始,然后迭代这些组,检查每个组中唯一的小时数。您可以使用<a href="https://docs.python.org/2/library/sets.html" rel="nofollow">^{<cd1>}</a>来查找每个测量日的唯一小时数,并与一整天的小时数进行比较<code>{0,1,2,3,...23}</code></p>
<pre><code>a_full_day = set(range(24))
#data_out = {}
gb = df.groupby(['jday']) # only group by day
for day, inds in gb.groups.iteritems():
if set(df.ix[inds, 'hour']) == a_full_day:
maxt = df.ix[inds, 'temp'].max()
#data_out[day] = {}
#data_out[day]['maxt'] = maxt
# etc
</code></pre>
<p>我添加了一些注释行,建议如何存储输出</p>