我有一年的 5 分钟数据,如下所示:df = pd.DataFrame([['1/1/2019 00:05', 1], ['1/1/2019 00:10', 5],['1/1/2019 00:15', 1], ['1/1/2019 00:20',3], ['1/1/2019 00:25', 1], ['1/1/2019 00:30', 2], ['1/1/2019 00:35', 6],['1/1/2019 00:40', 8],['1/1/2019 00:45', 1], ['1/1/2019 00:55', 2], ['1/1/2019 01:00', 8],['1/1/2019 01:05', 1], ['1/1/2019 01:10', 5],['1/1/2019 01:15', 1], ['1/1/2019 01:20',3],['1/1/2019 01:25', 1], ['1/1/2019 01:30', 2], ['1/1/2019 01:35', 6],['1/1/2019 01:40', 8],['1/1/2019 01:45', 1], ['1/1/2019 01:55', 2], ['1/1/2019 02:00', 8]], columns = ['Date','Value'])我希望在所有相应期间每小时转换一次。现在,每一行对应于特定日期和特定月份的一小时。像这样的东西:df = pd.DataFrame([['day1hour0month1', 1, 1, 3, 4, 1, 0, 1, 5, 2, 1, 3,3], ['day1hour1month1', 1, 1, 3, 4, 1, 0, 1, 5, 2, 1, 3,3], ['day1hour2month1', 1, 1, 3, 4, 1, 0, 1, 5, 2, 1, 3,3], ['day1hour3month1', 1, 1, 3, 4, 1, 0, 1, 5, 2, 1, 3,3], ['day1hour4month1', 1, 1, 3, 4, 1, 0, 1, 5, 2, 1, 3,3], ['day1hour5month1', 1, 1, 3, 4, 1, 0, 1, 5, 2, 1, 3,3], ['day1hour6month1', 1, 1, 3, 4, 1, 0, 1, 5, 2, 1, 3,3], ['day1hour7month1', 1, 1, 3, 4, 1, 0, 1, 5, 2, 1, 3,3], ['day1hour8month1', 1, 1, 3, 4, 1, 0, 1, 5, 2, 1, 3,3], ['day1hour9month1', 1, 1, 3, 4, 1, 0, 1, 5, 2, 1, 3,3], ['day31hour23month12', 1, 1, 8, 0, 6, 5, 3, 1, 1, 2,3,5]], columns = ['Date', 'min05', 'min10', 'min15', 'min20', 'min25', 'min30', 'min35', 'min40', 'min45', 'min50', 'min55', 'min60'])有没有办法使用 Pandas 时间序列功能(不使用 for 循环)来做到这一点?对于实施此操作的任何建议,我将不胜感激。先感谢您!
查看完整描述