gpt4 book ai didi

python - 对 Pandas 时间序列重新采样 30 分钟,共 9 个 :15 as start time

转载 作者:行者123 更新时间:2023-12-01 01:28:16 38 4
gpt4 key购买 nike

我正在尝试将 OHLC 数据重新采样到 30 分钟。市场数据从 9:15 开始,我希望重新采样的时间为 9:15-9:45,依此类推。但我能够将数据重新采样为 9:00-9:30

Paste Bin link to 1 min market data

pd.DataFrame(download_data).set_index('date'['close'].resample('30T').ohlc()

As you see in the picture the start time is 9:00 and not 9:15...

最佳答案

还有另一种方法可以做到这一点,您可以使用 resamplebase 参数:

pd.DataFrame(download_data).set_index('date'['close'].resample('30T', base=15).ohlc()

关于python - 对 Pandas 时间序列重新采样 30 分钟,共 9 个 :15 as start time,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53149168/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com