def show_weather_bydate(self):
self.weathdf['gap'] = self.weathdf['time_slotid'].apply(self.find_gap_by_timeslot)
by_date = self.weathdf.groupby('time_date')
size = len(by_date)
col_len = row_len = math.ceil(math.sqrt(size))
count = 1
for name, group in by_date:
ax=plt.subplot(row_len, col_len, count)
# temp = np.empty(group['time_id'].shape[0])
# temp.fill(2)
# ax.plot(group['time_id'], group['gap']/group['gap'].max(), 'r', alpha=0.75)
# ax.plot(group['time_id'], group['weather']/group['weather'].max())
ax.bar(group['time_id'], group['weather'], width=1)
ax.set_title(name)
count = count + 1
# plt.bar(group['time_id'], np.full(group['time_id'].shape[0], 5), width=1)
plt.show()
return
评论列表
文章目录