我有两个Pandas数据框。一个包含每日数据(dailyDf),一个包含5分钟数据(fiveMinDf)。现在添加fiveMinDf的前2个条作为列添加到dailyDf中的每一行
埃格
DailyDf
Open Close
01-01-2022 100 101
01-02-2022 102 103
fiveMinDf
Open Close
01-01-2022-9.30 100.1 100.2
01-01-2022-9.35 100.3 100.4
01-01-2022-9:40 100.9 100.9
01-02-2022-9.30 100.6 100.7
01-02-2022-9.35 100.8 100.49
01-02-2022-9:40 100.9 100.9
合并DF
DailyDf
Open Close open_5min_9.30 open_5min_9.35 close_5min_9.30 close_5min_9.35
01-01-2022 100 101. 100.1 100.3 100.2 100.4
01-02-2022 102 103 100.6 100.8 100.7 100.49
1条答案
按热度按时间yiytaume1#
注解代码
结果